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 Throwies, LEDs 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

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...

A SHOULDER SURFING RESISTANT GRAPHICAL AUTHENTICATION SYSTEM

A SHOULDER SURFING RESISTANT GRAPHICAL AUTHENTICATION SYSTEM ABSTRACT Authentication based on passwords is used largely in applications for computer security and privacy. However, human actions such as choosing bad passwords and inputting passwords in an insecure way are regarded as”the weakest link” in the authentication chain. Rather than arbitrary alphanumeric strings, users tend to choose passwords either short or meaningful for easy memorization. With web applications and mobile apps piling up, people can access these applications anytime and anywhere with various devices. This evolution brings great convenience but also increases the probability of exposing passwords to shoulder surfing attacks. Attackers can observe directly or use external recording devices to collect users’ credentials. To overcome this problem, we proposed a novel authentication system PassMatrix, based on graphical passwords to resist shoulder surfing attacks. With a one-time valid login indicator and ...

ABSTRACT

MULTI USER GSM BASED DIGITAL SCROLLING LED DISPLAY WITH PASSWORD AND VOICE ABSTRACT The project mainly focuses on transmission of textual data through air interface by the use of GSM through asynchronous serial communication. The data will be processed by the microcontroller it programmed by embedded c language by using KEIL C compiler. The data will be displayed on led display on LED only after entering unique pass key. Existing System: How a reliable and an authentic wireless communication could be easily developed between a mobile phone and microcontroller using GSM (Global System for Mobile Communication) MODEM (Modulator-Demodulator). This technical paper explains GSM based e-notice board which can be widely used for multitude of applications including educational sector, traffic control, banks, and public advertisements, stoke exchanges etc. Proposed System: In this project we not only send the data, but send the data with pass code also. Which enables us to preve...