Oh! That was a very simple fix that I'm glad you were able to help me with, sorry for taking so long to understand
And thank you for taking the time to help me with it
Here's the final code I finally got to run properly:
const int ledPin1 = 12; // first LED
const int ledPin2 = 13; // second LED
const int buttonPin1 = 7; // first button connected to LED 1
const int buttonPin2 = 8; // first buttonl connected to LED 2
int buttonState1 = 0; // this is the pushbutton status
int buttonState2 = 0;
void setup ()
{
(ledPin1, OUTPUT); // LED 1 is an output
(ledPin2, OUTPUT); // LED 2 is an output
(buttonPin1 , INPUT); // BUTTON 1 is an input
(buttonPin2 , INPUT); // BUTTON 2 is an input
}
void loop ()
{
buttonState1 = digitalRead (buttonPin1);
if (buttonState1 == HIGH) // when button 1 is low...
{
digitalWrite (ledPin1, HIGH); // ...LED 1 is low
}
else // ...if button 1 is high...
{
digitalWrite (ledPin1, LOW); // ...LED 1 turns on
}
buttonState2 = digitalRead (buttonPin2);
if (buttonState2 == HIGH)
{
digitalWrite (ledPin2, HIGH);
}
else
{
digitalWrite (ledPin2, LOW);
}
}