Sunday, February 9, 2014

Excercise 2: Blinking LED

Part 1
I found this to be fairly straightforward. I learned in this basic tutorial how to upload a command into the Arduino board.

int led = 13 means initiate pin 13 on the digital side of the Arduino
void setup means "the setup routine runs once when you press reset"
pinMode (led, OUTPUT) means it activates pin 13 as a digital output
Voidloop means that the code will be looped
Digital write (LED HIGH) turns the led on, high meaning high voltage
Digital write (LED LOW) turns the led off, low meaning no voltage
Delay (1000) there is a 1 second delay

Part2
As Carlos demonstrated in class, this step is very straight forward as well. To adjust the delay, you simply type how many millaseconds the led is on and off

Part 3
to innitiate two led's, I went into the first line of code and added "int led = 12" in the next line of code, I added pinMode (led2, OUTPUT); I then copied and pasted the digital write code and wrote "led2 HIGH and led2 LOW.
I uploaded the code into the arduino and plugged two led's into the breadboard. the flat sides of the leds were connected to "GND" on the digital side of the Arduino using jumper wires. The positive ends of the led's were wired to pin13 and pin 12. It Worked!!

Part 4
To add another led, I repeated the process I did in part 3. To change the order of the blinking, i went to the first line of code where int11 int12 int13 and changed the order of the numbers.

Part 5
For this step, I modeled my code from what I saw Leslie demonstrate in class. for each of the 3 void loops, I copied them three times so that each led blinks 3 times each. I adjusted the delay on led and led 3 blink at 500 milliseconds. The leds now blink SOS in morse code.



No comments:

Post a Comment