Created
June 18, 2025 18:36
-
-
Save ravenlp/5a6acff80708e43c621ff60fc9fcacba to your computer and use it in GitHub Desktop.
Simple Arduino IR trigger for cameras Sony a6300 a6200 etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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