Skip to content

Instantly share code, notes, and snippets.

@ravenlp
Created June 18, 2025 18:36
Show Gist options
  • Select an option

  • Save ravenlp/5a6acff80708e43c621ff60fc9fcacba to your computer and use it in GitHub Desktop.

Select an option

Save ravenlp/5a6acff80708e43c621ff60fc9fcacba to your computer and use it in GitHub Desktop.
Simple Arduino IR trigger for cameras Sony a6300 a6200 etc
#include <IRremote.hpp>
#define IR_LED_PIN 9
#define BUTTON_PIN 2
const unsigned long SONY_SHUTTER_CODE = 0xB4B8F;
const int BITS = 20;
unsigned long lastButtonPress = 0;
const unsigned long debounceDelay = 50; // 50 ms debounce
void setup() {
IrSender.begin(IR_LED_PIN);
pinMode(BUTTON_PIN, INPUT_PULLUP); // Use internal pull-up resistor
}
void loop() {
// Read button (active LOW)
if (digitalRead(BUTTON_PIN) == LOW) {
unsigned long now = millis();
if (now - lastButtonPress > debounceDelay) {
triggerShutter();
lastButtonPress = now;
}
}
}
void triggerShutter() {
for (int i = 0; i < 3; i++) {
IrSender.sendSony(SONY_SHUTTER_CODE, BITS);
delay(40);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment