Exercise 2
Exercise 2
Description:
Follow the circuit diagram and hook up the components on the breadboard
as shown in the image given below.
Note − To find out the polarity of an LED, look at it closely. The shorter of the
two legs, towards the flat edge of the bulb indicates the negative terminal.
Components like resistors need to have their terminals bent into 90° angles
in order to fit the breadboard sockets properly. You can also cut the terminals
shorter.
Sketch
Open the Arduino IDE software on your computer. Coding in the Arduino
language will control your circuit. Open the new sketch File by clicking New.
Components Required:
pinMode(2, OUTPUT) − Before you can use one of Arduino’s pins, you need
Code to Note
digitalWrite(2, HIGH) − When you are using a pin as an OUTPUT, you can
“function” called pinMode() to do this.