Nt1310 Unit 7 Lab

337 Words2 Pages

The objective of the lab was to program a vehicle board so that an LED would flash at .5 Hertz. This was done by using the Arduino software tool, the Redbot library, and using theses to write a program that would satisfy the requirements. . The following code used consisted of the two functions void setup and void loop. The void setup function runs once in order to configure the mainboards input and output pins. In the code, pin 13 is configured to display an output. This is done by using the pinMode instruction by typing 13 in the parentheses before the comma, and typing OUTPUT after the comma. The void loop function runs in a continuous loop unless the program reaches a line of code with a condition that forces it to break out of the loop. First, the digitalWrite instruction in the loop tells the program to use pin 13 by having that same number in the parentheses before the first comma. By putting HIGH after the comma, the program supplies 5 volts to pin 13 and lights up the LED. Next, the delay instruction is used to pause the program by the number that is placed in the parentheses in terms of milliseconds. The code has 1000 in the parentheses, so the amount of time that the LED stays on is 1000 milliseconds or 1 second. …show more content…

This tells the program to supply 0 volts the LED, resulting in it turning off. Finally, the delay instruction again causes the program to delay for 1000 milliseconds so that the LED remains unlit for that amount of time. Since there isn’t an instruction that makes the program exit the loop, the program will continue to run to run the instructions in the loop function

More about Nt1310 Unit 7 Lab

Open Document