Welcome to the N1IR Electronics Website. Totally off the cuff, one take, unrehearsed video projects for anyone interested in amateur radio, electronic design, makers, hardware hackers and science.


Get off you duff and build something!
Training the hand and mind since 1982.

Sunday, July 7, 2013

Police Style Strobe Light ATTiny85

Here is a new project for the freshmen it's a police style strobe light, you know the ones the flash three times then flash the other side three time and back and forth. I used the Arduino IDE to program and compile, I also used High-Low Tech Hardware file add-on and finally a stripped version (just resistors, took out the zeners) of the serial programmer DASA and the add-on for DASA to the Arduino software.





here is the code:

/*

Police Style Strobe Light

N1IR - Chris Johnson
email: n1ir@arrl.net

Arduino 1.0 IDE using ATTINY85
http://hlt.media.mit.edu/?p=1695

Pin 1 = RESET  Pin 8 = VCC
Pin 2 = PB3    Pin 7 = PB2
Pin 3 = PB4    Pin 6 = PB1
Pin 4 = Gnd    Pin 5 = PB0

*/

int led1 = 2; //delcare PB3 as led1
int led2 = 3; //declare PB4 as led2
int del = 500; //delay time in mS


void setup() {               
  pinMode(led1, OUTPUT); //Set led1 "PB3" to output   
  pinMode(led2, OUTPUT); //Set led2 "PB4" to output
}

// the loop routine runs over and over again forever:
 void loop() {

//Flash led1 three times 
 digitalWrite(led1, HIGH);  //Turn on led1 
 delay(del);                //Delay x amount of time
 digitalWrite(led1, LOW);   //Turn off led1
 delay(del);
 
 digitalWrite(led1, HIGH); 
 delay(del);
 digitalWrite(led1, LOW); 
 delay(del);

 digitalWrite(led1, HIGH);  dasa
 delay(del);
 digitalWrite(led1, LOW); 
 delay(del);
// End flash led1 three times

 delay(del); // Pause betwwen led1 and led2

 //Flash led2 three times
 digitalWrite(led2, HIGH); 
 delay(del);
 digitalWrite(led2, LOW); 
 delay(del);

 digitalWrite(led2, HIGH); 
 delay(del);
 digitalWrite(led2, LOW); 
 delay(del);

 digitalWrite(led2, HIGH); 
 delay(del);
 digitalWrite(led2, LOW); 
 delay(del);
// End flash led2 three times
}