Hi, guys! I am new in all this arduino stuff. Help me!!!
I've tried upload a sketch to use a pushdown button, but something got wrong and a I got this erro: "ledOnOff" was not declared in this scope. I've used the code below. It was a exercise from this book:"Arduino in Action" by Martin Evans, Joshua Noble and Jordan Hochenbaum.
volatile int state = LOW;
int ledArray[] = {8,9,10,11,12};
int count = 0;
int timer = 75;
int pause = 500;
void setup(){
for (count=0;count<5;count++){
pinMode(ledArray[count], OUTPUT);
}
attachInterrupt(0,ledOnOff,RISING);
}
void loop(){
if(state){
for (count=0;count<5;count=++){
digitalWrite(ledArray[count], HIGH);
delay(timer);
}
delay(pause);
for (count=0;count<5;count=++){
digitalWrite(ledArray[count], LOW);
delay(timer);
}
delay(pause);
}
}
void ledOFF(){
static unsigned long lastMillis = 0;
unsigned long newMillis = millis();
if(newMillis - lastMillis < 50){
}
else{
state = !state;
lastMillis = newMillis;
}
}