Created
April 17, 2019 15:57
-
-
Save honnet/86c26a626b65f17a3867213d681a1286 to your computer and use it in GitHub Desktop.
Code to trigger photos with arduino (ESP8266) and infrared to control a Nikon D5300.
This file contains 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
// inspiration: https://www.christidis.info/index.php/personal-projects/arduino-nikon-infrared-command-code | |
const int LEDpin = D3; | |
const int delay_us = 13; // 38 KHz | |
int i; | |
void setup() { | |
pinMode(LEDpin, OUTPUT); | |
} | |
void loop() { | |
takePhoto(); | |
delay(1000); | |
} | |
void takePhoto(void) { | |
for (i = 0; i < 76; i++) { | |
digitalWrite(LEDpin, HIGH); | |
delayMicroseconds(delay_us); | |
digitalWrite(LEDpin, LOW); | |
delayMicroseconds(delay_us); | |
} | |
delayMicroseconds(27880); | |
for (i = 0; i < 16; i++) { | |
digitalWrite(LEDpin, HIGH); | |
delayMicroseconds(delay_us); | |
digitalWrite(LEDpin, LOW); | |
delayMicroseconds(delay_us); | |
} | |
delayMicroseconds(1486); | |
for (i = 0; i < 16; i++) { | |
digitalWrite(LEDpin, HIGH); | |
delayMicroseconds(delay_us); | |
digitalWrite(LEDpin, LOW); | |
delayMicroseconds(delay_us); | |
} | |
delayMicroseconds(3484); | |
for (i = 0; i < 16; i++) { | |
digitalWrite(LEDpin, HIGH); | |
delayMicroseconds(delay_us); | |
digitalWrite(LEDpin, LOW); | |
delayMicroseconds(delay_us); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Schematics example:
https://cdn.instructables.com/FGC/3H3P/IJAACJL3/FGC3H3PIJAACJL3.LARGE.jpg
Logic analyser visualization (top = pulsed light // bottom = envelop):