Paso 6: Programar el chip
Programa el chip con este código:
/* Camera Flash M-Sync Mod This example code is in the public domain. */ int FlashDelay = 0; int shutterRelease = 0; int potValue = 0; void setup() { // initialize the digital pin as an output pinMode(0, OUTPUT); // initialize the shutter pin as an input pinMode(1, INPUT); } void loop() { //this reading is used to determine the legnth of the delay //in the upcoming if/else conditional statement potValue = analogRead(3); //if the potentiometer value is over 20, divide by 20 //this constrains the 0 to 1023 reasing to roughly //0ms to 51ms delay time. Centering the trim pot //should result in a 26ms (.026 second) delay time //which is necessary for M-Sync if(potValue > 19){ FlashDelay = (potValue / 20); } else{ FlashDelay = 0; } //checks to see if a picture has been taken shutterRelease = digitalRead(1); //upon the shutter release, triggers the camera flash //with whatever length of delay you set with the trim pot if(shutterRelease == 1){ delay(FlashDelay); digitalWrite(0, HIGH); delay(50); digitalWrite(0, LOW); //wait for flash to reset delay(6000); } }