Thursday, 19 November 2015

Arduino Lab 1: LED Blinking

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

No comments:

Post a Comment