Greg Schmidt Yes, I used an NPN BJT, some random ones I found in my junk box (I tested them first). The caps are 2200uf and the resistors are 10k. You may have noticed that I omitted the current limiting resistors for the LEDs, but I think that's OK when running off of battery power since the battery inherently limits the current.
int variable @ 9:30
int LEDState=0;
int LEDPin=8;
int buttonPin=12;
int buttonNew;
int buttonOld=1;
int dt=100;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LEDPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonNew=digitalRead(buttonPin);
if(buttonOld==0 && buttonNew==1){
if (LEDState==0){
digitalWrite(LEDPin,HIGH);
LEDState=1;
}
else{
digitalWrite(LEDPin, LOW);
LEDState=0;
}
}
buttonOld=buttonNew;
delay(dt);
}