Go Down

Topic: Always have to do a Reset (Read 616 times) previous topic - next topic

mitcho

Oct 12, 2006, 07:54 am Last Edit: Oct 12, 2006, 07:55 am by mitcho Reason: 1
Hi, ive made a simple program to switch LEDS on and off. I keep my arduino stored in a box with a 9v battery and a power switch.

the switching works fine until i turn the board off.

everytime i turn the power back onto the arduino board, nothing happens. i have to do a manual reset before anything will happen again.

Why do i have to keep reseting. is there some code i can put to make sure the program starts as soon as i turn power on?

here is my code:
Code: [Select]

//ASSIGN PINS//

int foul1 = 7;  
int foul2 = 9;  


void setup()
{
 pinMode(foul1, OUTPUT);
 pinMode(foul2, OUTPUT);

}

void loop() {

   digitalWrite(foul1, LOW);
   digitalWrite(foul2, LOW);

   delay(2000);

   digitalWrite(foul1, HIGH);
   
   delay(1500);

   digitalWrite(foul2, HIGH);
 
   delay(1500);

   digitalWrite(foul1, LOW);
 
   delay(1500);

   digitalWrite(foul2, LOW);
   
   delay(10000);

}


Go Up