Newbie to Arduino Code Help

Hi To All I Have this circuit it is a lightning trigger and i tried to make the codes for it but they are not working not even the power led is not powering up can someone help me please

Thank You !!

#define SHUTTER_PIN 5
#define LIGHTNING_TRIGGER_ANALOG_PIN 0
#define TRIGGER_THRESHHOLD 5

int lightningVal;

void setup()
{
pinMode(SHUTTER_PIN, OUTPUT);
digitalWrite(SHUTTER_PIN, LOW);
pinMode(6, OUTPUT); // Your blink LED
digitalWrite(6, HIGH); // Turn off your blink LED
pinMode(7, OUTPUT); // Your power LED); Your power LED pin
digitalWrite(7, LOW); // Turn on your power LED
Serial.begin(9600); // open serial

lightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
}

void loop()
{
int cmd;
int newLightningVal = analogRead(LIGHTNING_TRIGGER_ANALOG_PIN);
Serial.println(lightningVal, DEC);

if (abs(newLightningVal - lightningVal) > TRIGGER_THRESHHOLD)
{
digitalWrite(SHUTTER_PIN, HIGH);
digitalWrite(6, LOW); // Turn on your blink LED
delay(1000); // May want to adjust this depending on shot type
digitalWrite(SHUTTER_PIN, LOW);
digitalWrite(6, HIGH); //Turn off your blink LED
Serial.println("Shutter triggered");
}

lightningVal = newLightningVal;

I'd suggest that if you're not even getting it powered up properly then something is probably wrong before you even get to the software side. Go back through and make sure everything is set up correctly and test your software with a more basic set up as well so you can see it's supplying the board correctly and then step through each component to check where it might be failing.

cheers ajfisher

everything is set up correctly !!

Thanks

Where is + input terminal connected? Have you install a switch and turn it on?

  • + ----[] [] []----[] [] 9v battery on off switch
pinMode([color=red]6[/color], OUTPUT); // Your blink LED
digitalWrite(6, HIGH); // Turn off your blink LED
pinMode([color=red]7[/color], OUTPUT); // Your power LED); Your power LED pin
digitalWrite(7, LOW); // Turn on your power LED

Did you swap a pins? On a board 6 con. to power ind. led, and 7 con. to trigger release.