0% found this document useful (0 votes)
59 views

Arduion Experiment Work

This document provides instructions and code examples for 10 Arduino projects of increasing complexity that involve blinking LEDs, reading inputs from buttons, potentiometers, and controlling multiple LEDs. The projects include blinking a single LED, flashing LEDs, shifting multiple LEDs, controlling a traffic light, reading a button input, controlling LED brightness with a potentiometer, using an RGB LED, scrolling LEDs up and down, making a LED bar graph controlled by a potentiometer, and blinking multiple LEDs at once. Diagrams and parts lists are provided for each project.

Uploaded by

mohamed ramadan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Arduion Experiment Work

This document provides instructions and code examples for 10 Arduino projects of increasing complexity that involve blinking LEDs, reading inputs from buttons, potentiometers, and controlling multiple LEDs. The projects include blinking a single LED, flashing LEDs, shifting multiple LEDs, controlling a traffic light, reading a button input, controlling LED brightness with a potentiometer, using an RGB LED, scrolling LEDs up and down, making a LED bar graph controlled by a potentiometer, and blinking multiple LEDs at once. Diagrams and parts lists are provided for each project.

Uploaded by

mohamed ramadan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Arduion Experiment work

1 – Test Arduino

This project will test your Arduino by blinking an


LED that is connected directly to the board.

Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) LED 5mm
(1) 220 Ω Resistor

Project Diagram
Program code

• void setup()
{
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(13, HIGH); // Turn on the LED
delay(1000); // Wait for one second
digitalWrite(13, LOW); // Turn off the LED
delay(1000); // Wait for one second
}
2 -Flash
void setup() {
// initialize digital pin 11 as an output.
pinMode(11, OUTPUT);
}

// the loop function runs over and over again forever


void loop() {
digitalWrite(11, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(11, LOW); // turn the LED off
delay(1000); // wait for a second
}
Flash

Try to change the Delay


and Pin
3-10 Led shift flash

void setup() {
// initialize digital pin 11 as an output.
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
digitalWrite(8, LOW);
void loop() { digitalWrite(9, HIGH); delay(1000);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(9, LOW);
digitalWrite(4, LOW); digitalWrite(10, HIGH); delay(1000);
digitalWrite(5, HIGH);
delay(1000); digitalWrite(10, LOW);
digitalWrite(11, HIGH); delay(1000);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
delay(1000); digitalWrite(11, LOW);
digitalWrite(12, HIGH); delay(1000);
digitalWrite(6, LOW);
digitalWrite(7, HIGH); digitalWrite(12, LOW);
delay(1000); digitalWrite(13, HIGH); delay(1000);

digitalWrite(7, LOW);
digitalWrite(8, HIGH);
delay(1000);
digitalWrite(13, LOW); }
Using For command
void setup() {
// initialize digital pin 11 as an output.
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
for (I=4;I<=13;I++) {
digitalWrite(I, HIGH);
delay(1000);
digitalWrite(I, LOW);
}
}
10 Led shift flash
with different delay

Try to change the Delay by


reading Potentiometer
4-Traffic Light
void setup() {
// initialize digital pin 11 as an output.

pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {

digitalWrite(8, HIGH);
delay(70000);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(15000);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delay(150000);
digitalWrite(10, LOW);
}
Traffic Light
• Modify the program to
control traffic light in
the illustrated circuit
Traffic Light for Square

Write a program to control


a traffic light for a square

Direction 1 Direction 2 Time


(Sec)
Red 1 Green 2 75
Red 1 Yello 2 15
Green 1 Red 2 75
Yellow 1 Red 2 15
5 – Push Button

Using a push button switch, you will be able to turn on and off an LED.

Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(1) LED 5mm
(1) 220 Ω Resistor
(1) 10K Ω Resistor
(1) Push Button Switch
(6) Jumper Wires
Program code
void setup() {
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output:
pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input:
}

void loop() {
buttonState = digitalRead(buttonPin); // read the state of the pushbutton value:

if (buttonState == HIGH) { // check if the pushbutton is pressed.


// if it is, the buttonState is HIGH:
digitalWrite(ledPin, HIGH); // turn LED on:
}
else {
digitalWrite(ledPin, LOW); // turn LED off:
6 – Potentiometer

Using a potentiometer, you will be able to control the resistance of an LED.


 Turning the knob will increase and decrease the frequency the LED blinks.

Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(1) LED 5mm
(1) 220 Ω Resistor
(1) Potentiometer (10k Trimpot)
(6) Jumper Wires
Program code
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}

void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for <sensorValue> milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for <sensorValue> milliseconds:
delay(sensorValue);
}
7 – RGB LED

This project will be using an RGB LED to scroll


through a variety of colors.  RGB stands for
Red, Green and Blue and this LED has the
ability to create nearly unlimited color
combinations.
Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(1) RGB LED
(3) 330 Ω Resistor
(5) Jumper Wires
const int RED_PIN = 9;
const int GREEN_PIN = 10;
const int BLUE_PIN = 11;

void setup()
{ //Configure the Arduino pins to be outputs to drive the LEDs
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
}
void loop()
{
// LED is Red
digitalWrite(RED_PIN, HIGH);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, LOW);
delay(DISPLAY_TIME);
// LED is Green
digitalWrite(RED_PIN, LOW );
digitalWrite(GREEN_PIN, HIGH);
digitalWrite(BLUE_PIN, LOW);
delay(DISPLAY_TIME);
.
.
.
}
8 – Scrolling LED

This project will blink 6 LEDs, one at a time, in a up and down formation.  

Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(6) LED 5mm
(6) 220 Ω Resistor
(7) Jumper Wires
9 – Bar Graph

Problem
Using a potentiometer, you can
control a series of LEDs in a
column. Turning the
potentiometer knob will turn on or
off more of the LEDs.
Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(1) Potentiometer – Rotary
(10) LED 5mm
(10) 220 Ω Resistor
(11) Jumper Wires
10 – Multiple LEDs
Problem
This project will use 8 pins on the Arduino
board to blink 8 LEDs at the same time.
Parts Needed
(1) Arduino Uno
(1) USB A-to-B Cable
(1) Breadboard – Half Size
(8) LED 5mm
(8) 330 Ω Resistor
(9) Jumper Wires

You might also like