Purpose:
This lab will teach you how to change one LED's brightness according the level of light that is hitting the light sensor.
Equipment:
-1 light sensor
-1 10k ohm resistor
-1 LED (any colour)
-330 ohm resistor
-1 wire (red)
-1 wire (black)
-4 wires (any colour)
-1 Arduino UNO
-1 breadboard
-1 USB cable
Program Details:
-Download Arduino here
Time to Program and Complete:
-Approximately 25 min
Results:
-There were no issues and it worked completely fine
Photo/Video:
Program:
int lightPin = 0;
int ledPin = 9;
void setup()
{
pinMode (ledPin, OUTPUT);
}
void loop()
{
int lightLevel = analogRead(lightPin);
lightLevel = map(lightLevel, 0, 900, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);
analogWrite(ledPin, lightLevel);
}
Program Modifications:
-There were none
Helpful Tips:
-Check spelling/spacing
References:
-Arduino website: arduino.cc
-New Innovators: Lab 6
Purpose:
This lab will teach you how to control LED lights using buttons.
Equipment:
-2 push buttons
-1 330 ohm resistor
-2 10k ohm resistors
-1 LED
-1 wire (red)
-1 wire (black)
-4 wires (any colour)
-1 Arduino UNO
-1 breadboard
-1 USB cable
Program Details:
-Download Arduino here
Time to Program and Complete:
-Approximately 30 min
Results:
-There were some issues with spacing but after I fixed them it worked completely fine.
Photo/Video:
Program:
const int buttonPin = 2;
const int ledPin = 9;
int buttonState = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin,INPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
Program Modifications:
-There were none; I followed all the instructions
Helpful Tips:
-Check spacing
-Check all the parts on the breadboard
References:
-Arduino website: arduino.cc
-New Innovators: Lab 3
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