This circuit has been tested with an LED and a solar igniter at the output of the relay and works with both. The code used for the Atmega 328 is posted below. 
/*
 Balloon Exploder
 Standby: Repeatedly blinks an LED
 Recieves voltage at input, turns off standby
 Waits 5 seconds, then sends a HIGH out to 12 and 13(LED)
*/
void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected
  pinMode(13, OUTPUT);    //pin 13 is set to an output
  pinMode(8, INPUT);      //pin 8 is set to an input
  pinMode(12, OUTPUT);    //pin 12 is set to output
  digitalWrite(12,LOW);   //pin 12 is initialized as low
}
void loop(){
  while(digitalRead(8)==LOW){   // while loop reads pin 8 and will stay in loop until pin 8 recieves 5 volts
    digitalWrite(13, HIGH);  //writes pin 13 to 5 volts
    delay(1000);             //waits a second
    digitalWrite(13, LOW);   //writes pin 13 to 0 volts
    delay(1000);             //watis a seconds
  }                          
  delay(5000);               // delays 5 seconds
  digitalWrite(13, HIGH);    //sets pin 13 to 5 volts
  digitalWrite(12, HIGH);    //sets pin 12 to 5 volts for transistor
  while(1==1);               //stays in this state until reset
}

 
No comments:
Post a Comment