Newbie issue
hi, can't make work.
what want turn led on press of button , turn off press.
what want turn led on press of button , turn off press.
code: [select]
const int = 2;
const int led = 5;
int state = 0;
int statelast = 0;
void setup() {
// put setup code here, run once:
pinmode(but, input);
pinmode(led, input);
serial.begin(9600);
}
void loop() {
state = digitalread(but);
if (state == high && statelast == low){
digitalwrite (led, high);
}
else if (state == high && statelast == high){
digitalwrite (led, low);
}
statelast = state;
delay(100);
}
quote
what want turn led on press of button , turn off press.well, have our permission that.
posting code without explaining how hardware connected , code does, , how differs want, rather pointless.
Arduino Forum > Using Arduino > Programming Questions > Newbie issue
arduino
Comments
Post a Comment