when i put an If statment inside of a loop() function it does not continue looping. Once the if statment is true the board remains in that state and doesn't change anymore. attached is my code. Any suggustions or is this a bug in the board?
int ledPin = 13; // LED connected to digital pin 13
int buttonPin = 7; // pushbutton connect to digital pin 7
int val = 0; // Set initial state to LED off
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(buttonPin, INPUT); // sets the gitial pin 7 as an input
}
void loop()
{
val = digitalRead(buttonPin); //read the input of pin 7
if(val == 1)
{
digitalWrite(ledPin, val); // sets the LED of pin 13
}
}