티스토리 뷰

Arduino (En)

8 LEDs shift using Arduino uno

iiieee 2020. 2. 18. 22:07

I tried to turn on 8 LEDs sequentially using the Arduino Digital Pin0 to Pin7.

To find out what pins do on the Arduion Uno board, I looked up the pinmap.

Arduino Uno Pinout

Reference : https://www.theengineeringprojects.com/2018/06/introduction-to-arduino-uno.html

 

Introduction to Arduino Uno - The Engineering Projects

Today, I am going to uncover the details on the Introduction to Arduino Uno. It is a microcontroller board developed by Arduino and based on Atmega328. 

www.theengineeringprojects.com

Plug eight jumper wires into the Arduino Digital Pin0 to Pin7.

Digital Pin0 ~ Pin7

Other side of the jumper wires are plugged into the breadboard and connected with LEDs and 220 ohm resistors as shown.

8 LEDs & resistors
8 LEDs & resistors

The minus line (GND) where the ends of the resistors are plugged connects to the GND on Arduino board.

GND connection (Breadboard)
GND connection (Arduino)

Run Arduino IDE and write a code as follows.

8LEDs shift code

"pinMode" defines a specific pin as an output or an input.

Dgital Pin0 to Pin7 are defined as OUTPUT using for loop.

"digitalWrite" is a function that send 5 voltage (High) or 0 voltage (Low) through the specific pin.

"delay (1000)" can hold the status of the LEDs for 1 second (1000 ms).

 

Compile and upload the code into the Arduino.

However, error occurred while uploading the code and the file uploading failed. 

Error message
Uploading error

After trial and error, I was able to upload the file by disconnecting jumper wire connected to Digitalpin0.

Digitalpin0 also can be a serial port RXD, which is probably related to this.

After upload the file, I could check the LEDs shift successfully.

 

 

댓글
공지사항
최근에 올라온 글