Skip to main content

Arduino Basic Tutorials - How to Control LEDs

Picture of Arduino Basic Tutorials - How to Control LEDs
This instructable shows how to control one or more LEDs with Arduino and then we will know how to use the digital and analog IO pins. Never done any work before with Arduino and don't know how to use it. Never mind, you will find that it is really easy to start a Arduino project.

Step 1: Arduino Pin Instruction

Picture of Arduino Pin Instruction
We can refer to this page to get the Arduino Pins instructions.
If you find that it is a little difficult to understand these commands, You can skip this step and only need to know which pins is the Digital Pins(0-13)and Analog Pins(0-5) and then go to next step. After you finish these projects, you will find that these commands is really easy.




Step 2: Materials

The following will be needed
Arduino X 1 We used Crowduino in the following projects and Crowduino is Arduino compatible board with Duemilanove bootloader. Any Arduino compatible board would be ok for finishing these projects.
USB cable x 1
Resisters 200R x10
Resisters 10K x1
LED x5
breadboard x1
Jumper wires
If you don't have these components yet, this component kit may help you. It includes all the components except the Arduino board. This Arduino basic kit can aslo be ok for the following projects and it include one Crowduino and printed guide book for some other projects.
You may need to download one Arduino IDE at the page if you don't have. There are several versions for different Operating System. You can refer to this page to know more.

Step 3: Control One LED

Lighting up one LED is the beginning of Arduino learning. Through this experiment, you will be able to run with Arduino world easier.
Materials used: 
Crowduino x 1
LED x 1
200R resister x 1
USB cable x 1
Jumper wires
Hardware Connection: You can connect the hardware as the upper picture. Note:the long pin of LED is positive and the short pin is negative. If you don’t know how to use the LED, you can get more details by search LED on instructable. There are a lot of great instrutables for LED. Such as LED ThrowiesLEDs for Beginners. and so on.
Program Upload:
Download the Arduino Demo Code. Open the P01_ Control_one_LED.ino with Arduino IDE as below and upload to the Crowduino or Arduino board. If you don't know how to upload the program, you can do one basic experiment following the steps at this page. After uploading the program, you will see that the LED will blink once per second.
It used function pinMode() and digitalWrite() in this program.

Step 4: Control Two LEDs

Is the experiment about lighting one LED really easy. Yes, Let's to go to light up and control two LEDs.
Materials:
Crowduino x 1
LED x 2
200R resister x 2
USB cable x 1
Jumper wire x 4
Hardware Connection: Connect the hardware following the upper picture.
Upload program: Open the Arduino Code P02_Control_two_LED.ino and upload it to Crowduino.
After the programming, the LEDs will blink once per second. You can change the delay() parameter in the program to change the interval. At the same time, you can also change the program to make the two LEDs flash alternately.

Step 5: Control LED with Button

How can light a led when I want it to light? Here we will know how to control a LED to turn on/off with button(you can change the button with other sensor when you are fimiliar with Arduino).
Materials:
  • Crowduino x 1
  • LED x 1
  • 200R resister x 2
  • Button x 1
  • USB cable x 1
  • Jumper wires

Hardware Connection: You can connect the hardware as the upper picture.
Program upload:
open the Arduino Code P03_Button_Control_LED.ino and upload it to Crowduino. When the button is pressed, the LED will turn on. Otherwise, the LED turns off.
In this program, the Arduino reads the status of the button with the functiondigitalRead() and and control the LED with digitalWrite().

Step 6: Read the Analog Value

And now, we know the how to use the 0 and 1 digital signal in Arduino. Here we will know how to input analog signal and display the analog value via serial port.
Materials:
Potentiometer x 1
Crowduino x1
USB cable x1
Jumper wires
Hardware Connection: Connect the hardware as the upper picture.
Upload the Code:
Open the P04_AnalogInOutSerial.ino,and upload it to the Crowduino. Then open the serial monitor, you can see the value printed on the serial port will change with the rotation of Potentiometer in the area 0~1023.
It used function Serial.begin(),Serial.print()Serial.println() , delay() andAnalogread() in the program.

Step 7: Running Light

From the upper projects, we do know how to do some simple project. Let's do a little complex project now. how about making a running LED which the flashing speed is changeable with the rotation of the potentiometer. this project consists of 5 LEDs in different colors and a potentiometer.
Connect the hardward following the upper picture and upload P05_FlashLED.ino code to Crowduino.
The demo result is shown as the upper picture.To get more colorful effects by adjusting the potentiometer.

Comments

Popular posts from this blog

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM Abstract Allocating service capacities in cloud computing is based on the assumption that they are unlimited and can be used at any time. However, available service capacities change with workload and cannot satisfy users’ requests at any time from the cloud provider’s perspective because cloud services can be shared by multiple tasks. Cloud service providers provide available time slots for new user’s requests based on available capacities. In this paper, we consider workflow scheduling with deadline and time slot availability in cloud computing. An iterated heuristic framework is presented for the problem under study which mainly consists of initial solution construction, improvement, and perturbation. Three initial solution construction strategies, two greedy- and fair-based improvement strategies and a perturbation strategy are proposed. Different strategies in the three phases result in several heuristics. ...

Android Tutorial

Android  is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc. It contains a  linux-based Operating System ,  middleware  and  key mobile applications . It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions etc. This tutorial is developed for beginners and experienced persons. Let's see the topics of android that we are going to learn. Basics of Android In this fundamental chapter, you will learn about android, its components, how to create first android application, internal of first android application etc. What is Android History and Version Software Stack Core Building Blocks Android Emulator Installing softwares Setup Eclipse Hello Android example Internal Details Dalvik VM AndroidManifest.xml R.java Hide Title Bar Activity and I...

Force Sensing Resistor FSR400

Force Sensing Resistor FSR400 This is a small  force sensitive resistor . It has a 0.16" (4 mm) diameter active sensing area. This FSR will vary its resistance depending on how much pressure is being applied to the sensing area. The harder the force, the lower the resistance. When no pressure is being applied to the FSR, its resistance will be larger than 1MΩ, with full pressure applied the resistance will be 2.5kΩ. Two pins extend from the bottom of the sensor with 0.1" pitch making it bread board friendly. These sensors are simple to set up and great for sensing pressure, but they aren't incredibly accurate. Use them to sense if it's being squeezed, but you may not want to use it as a scale. Dimensions: Overall length: 1.75" Overall width: 0.28" Sensing area: 0.3"