Pages: [1]   Go Down
Author Topic: Newbie to Arduino Code Help  (Read 676 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 !!





Code:
#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;
Logged

Melbourne
Offline Offline
Jr. Member
**
Karma: 2
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

everything is set up correctly !!

Thanks
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is + input terminal connected?
Have you install a switch and turn it on?
« Last Edit: February 27, 2011, 08:01:43 am by Magician » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

     -     +
----[]  []    []----[]     []
9v battery         on off switch
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.
Logged

Pages: [1]   Go Up
Jump to: