Dive into the world of Robotics with an Arduino Course

Home Lessons
Science &
Engineering
Robotics &
Coding
Save your &
Progress
Individual &
Lessons

Arduino Lesson 2 - digitalRead & digitalWrite

The led's wiring can be found here, you can wire it up using a breadboard, although I have it soldered onto a circuit board because it's easier that way: https://www.arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png

The second in a series of tutorials to help you understand the basics of the Arduino uno. In this session we will be going over digitalReads and digitalWrites and how to use them in the "real world"

Here is code written in the lesson :)


                    int led = 12;
                    int button = 1;
    
                    void setup() {
                    pinMode(led, OUTPUT);  // e.g. 
                    pinMode(button, INPUT);
    
                    }
    
    
                    void loop() {
                    
                    digitalRead(button);
    
                    digitalWrite(led, LOW);
                    delay(200);    // in ms
                    digitalWrite(led, HIGH);
                    delay(200);
    
                    }
                

I hope you enjoy the video!

Arduino software (IDE): https://www.arduino.cc/en/Main/Software
Buy me a coffeeBuy me a coffee