Purpose:
This lab will make multiple LED lights blink.
Equipment:
-4 LEDs
-4 330 ohm resistors
-1 wire (black)
-1 wire (red)
-4 wires (any colour)
-1 Arduino UNO
-1 breadboard
-1 USB cable
Program Details:
-Download Arduino here
Time to Program and Complete:
-Approximately 20 min
Results:
-The LEDs blink repeatedly as the program uploaded: 4 LEDs blink with high power first then with low power, and start over again.
Photo/Video:
Program:
int ledPin1=2;
int ledPin2=3;
int ledPin3=4;
int ledPin4=5;
void setup()
{
pinMode(ledPin1,OUTPUT);
pinMode(ledPin2,OUTPUT);
pinMode(ledPin3,OUTPUT);
pinMode(ledPin4,OUTPUT);
}
void loop()
{
int delayTime = 100;
digitalWrite(ledPin1, HIGH);
delay (delayTime);
digitalWrite(ledPin2, HIGH);
delay (delayTime);
digitalWrite(ledPin3, HIGH);
delay (delayTime);
digitalWrite(ledPin4, HIGH);
delay (delayTime);
delay (delayTime);
digitalWrite(ledPin4, LOW);
delay (delayTime);
digitalWrite(ledPin3,LOW);
delay (delayTime);
digitalWrite(ledPin2,LOW);
delay (delayTime);
digitalWrite(ledPin1,LOW);
delay (delayTime);
}
Program Modifications:
-There were none
Helpful Tips:
-Name the pins so it is easier to write codes
-Remember not to power on Arduino until you are ready too
References:
-Arduino website: arduino.cc
-New Innovators: Lab 2
Purpose:
This lab will make one LED blink.
Equipment:
-1 LED
-1 330ohm resistor
-3 wires
-1 Arduino UNO
-1 breadboard
-1 USB cable
Program Details:
-Download Arduino here
Time to Program and Complete:
-Approximately 15 min
Results:
-The LED light blinks repeatedly
Photo/Video:
Program:
int ledPin = 13; //This creates an integer, ledPin, equals to 13
void setup() //This allows the program to know what we are doing before we use them; normally we put variables that function use in the () that follow, but since we have none, the () are empty
{ //This bracket indicates the start of the setup function
pinMode(ledPin, OUTPUT); //pinMode defines whether a pin is output or input. In this case, ledPin, is an output
} //This bracket indicates the end of the setup function
void loop() //This declares that the code in this loop will run forever
{ //This indicates the start of the loop function
digitalWrite(ledPin, HIGH); //The digitalWrite turns the ledPin (pin 13) on high power
delay(1000); //This line will make Arduino wait for one second and continue on
digitalWrite(ledPin, LOW); //The digitalWrite turns the ledPin (pin 13) on low power
delay(1000); //This line will make Arduino to wait for one second and return part to the start of the loop
} //This indicates the end of the loop function
Program Modifications:
-There were none
Helpful Tips:
-Don't plug in or power up your Arduino if you are still inserting parts!
References:
-Arduino website: arduino.cc
-Other reference: Lab 1