Buttons on LED off Arduino project on November 12, 2019 Get link Facebook X Pinterest Email Other Apps Circuit Diagram: Buttons on LED off Arduino project project details project details...... Code: const int ledPin = 7; // setup led in pin 7 const int switchPin = 8; // setup switch in pin 8 void setup() { // put your setup code here, to run once: pinMode(switchPin , INPUT); pinMode(ledPin , OUTPUT); // setting the LED as an OUTPUT } void loop() { // put your main code here, to run repeatedly: if(digitalRead(switchPin) == HIGH) // if you press the switch { digitalWrite(ledPin , HIGH); // turn on the LED } else // otherwise { digitalWrite(ledPin , LOW); // turn off the LED } } Project Testing Video: Comments
Comments
Post a Comment