Toggling an LED from High to Low

Hi all.

I'm having some programming trouble with a circuit I'm working with. I have an LED and two buttons, and my desired output for this is to have the LED become lit (obtain a HIGH state) when Button 1 is pressed, and have the LED turn off (obtain a LOW state) when Button 2 is pressed.

I'm a little unsure of how to best structure my syntax and which loop/loop conditions are necessary in order to obtain the desired result from above.

Thank you!

The Button example from the IDE shows reading a button and switching an LED on and off. Start from there and have a go at modifying it for two buttons. If you have trouble post your best attempt here and we'll help from there.

Steve

when Button 1 is pressed,

when Button 2 is pressed

I suspect that you mean you want something to happen when a button becomes pressed. If so then look at the StateChangeDetection example in the IDE.