Content

  1. Introduction
  2. Preparations
  3. Connection
  4. Upload Sketch
  5. Program Running Result

Introduction

In this lesson we will realize the function of eight of flowing water light,  from left to right, each only light one LED,reciprocating cycle.

Preparations

Hardware

  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • Breadboard x 1
  • LED x 8
  • 200 ohm resistor x 8
  • M/M jumper x 20
  • USB Cable x 1
  • PC x 1

Software

Arduino IDE (version 1.6.4+)

Connection

You can wiring your hardware as below :

Why do I empty 0 and 1 and two interfaces? These two interfaces actually use as the board’s serial ports, TX and Rx, that is to say, if you connect led on these two interfaces, you can’t download the normal program. So, generally we will empty out, if must use the case, you need to download a good program first, and then connect the circuit.

Note:

You cannot directly connect an LED to a battery or voltage source. Firstly, because the LED has a positive and a negative lead and will not light if they are the wrong way around and secondly, an LED must be used with a resistor to limit or ‘choke’ the amount of current flowing through the LED – otherwise the LED could burn out!

Upload Sketch

If you have connected the wiring diagram, connect the Arduino Uno board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

Open the Arduino IDE,and choose the corresponding board type and port type for your Arduino,then open the sketch or copy below code to your IDE window:

void setup()
{
  for (int i=2; i<=9; i++)    //Set the pin2~pin8 cycle output
  {
    pinMode(i,OUTPUT);
  }
}
void loop()
{
  for (int x=2; x<=9; x++)   //Each LED will flash in one second
  {
    digitalWrite(x,HIGH);
    delay(500);
    digitalWrite(x,LOW);
    delay(500);
  }
}

Now, simply click the “Upload” button in the environment. Wait a few seconds – you should see the RX and TX leds on the board flashing. If the upload is successful, the message “Done uploading.” will appear in the status bar.

Running Result

A few seconds after the upload finishes, you should  realize the function of eight of flowing water light,  from left to right, each only light one LED,reciprocating cycle. If it does, congratulations! You’ve gotten Arduino up-and-running.

Leave a Reply

WordPress spam blocked by CleanTalk.
Bombax Theme designed by itx