EasyManua.ls Logo

Elegoo Mega2560 - Page 63

Elegoo Mega2560
224 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
63
/
223
{
digitalWrite(ledPin, LOW);
}
}
In the 'loop' function there are two 'if' statements. One for each button. Each does
an 'digitalRead' on the appropriate input.
Remember that if the button is pressed, the corresponding input will be LOW, if
button A is low, then a 'digitalWrite' on the ledPin turns it on.
Similarly, if button B is pressed, a LOW is written to the ledPin.
Example picture

Table of Contents