Hi, im pretty new to arduino, and programming in general, and i just cant figure out this code. I am tryinng to make a code that takes imput from two buttons (pins 8(left) and 9(right), an has one led (pin 13). when the program starts the lights is turned off. if you click the left button (push and release) it starts the led blinking 5 times a second, and stops blinking when you click(push and release) the right button. so click the left one starts the blinking and clicking the right one stops it.
this is the best i could come up with, im afraid its not much
int led = 13;
const int buttonPinLeft = 9;
const int buttonPinRight = 8;
int state;
void setup()
{
pinMode(buttonPinLeft, INPUT);
pinMode(buttonPinRight, INPUT);
pinMode(led, OUTPUT);
state = 0;
}
void loop()
{
if(state == 1)
{
for(int i=0; i<5; i++)
{
digitalWrite(led, HIGH);
delay(200);
digitalWrite(led, LOW);
delay(200);
}
}
if
}
any help would be greatly appreciated!