
41/78
gle line comments start with // and everything up until the end of that line is considered a comment.
The first line of code is:
int led = 13;
As the comment above it explains, this is giving a name to the pin that the LED is attached to. This is 13 on most Arduinos, including the
UNO and Leonardo.
Next, we have the 'setup' function. Again, as the comment says, this is executed when the reset button is pressed. It is also executed
whenever the board resets for any reason, such as power first being applied to it, or after a sketch has been uploaded.
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
Every Arduino sketch must have a 'setup' function, and the place where you might want to add instructions of your own is between the
{ and the }.
In this case, there is just one command there, which, as the comment states tells the Arduino board that we are going to use the LED pin
as an output.
It is also mandatory for a sketch to have a 'loop' function. Unlike the 'setup' function that only runs once, after a reset, the 'loop' function
will, after it has finished running its commands, immediately start again.
void loop() { digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW);
delay(1000);
}
Inside the loop function, the commands first of all turn the LED pin on (HIGH), then 'delay' for 1000 milliseconds (1 second), then turn
the LED pin off and pause for another second.
// turn the LED on (HIGH is the voltage
level) // wait for a second
Содержание Obstacle Avoidance Smart Car Kit
Страница 1: ...Obstacle Avoidance Smart Car Kit...
Страница 2: ......
Страница 6: ...4 78 Packing list...
Страница 9: ...7 78 Click Windows Installer Click JUST DOWNLOAD...
Страница 11: ...9 78 Click I Agree to see the following interface...
Страница 12: ...10 78 Click Next You can press Browse to choose an installation path or directly type in the directory you want...
Страница 14: ...12 78 Next the following icon appears on the desktop Double click to enter the desired development environment...
Страница 16: ...14 78...
Страница 18: ...16 78 Right click on the device and select the top menu option Update Driver Software...
Страница 26: ...24 78...
Страница 31: ...29 78 Once open you should see something like this...
Страница 36: ...34 78 When the sketch window opens enlarge it so that you can see the entire sketch in the window...
Страница 45: ...43 78 Lesson 4 Installation Method...
Страница 46: ...44 78...
Страница 47: ...45 78...
Страница 48: ...46 78...
Страница 49: ...47 78...
Страница 50: ...48 78...
Страница 51: ...49 78...
Страница 52: ...50 78...
Страница 53: ...51 78...
Страница 54: ...52 78...
Страница 55: ...53 78...
Страница 57: ...55 78 Connection diagram...
Страница 61: ...59 78 Wiring diagram...
Страница 65: ...63 78 Wiring diagram...
Страница 67: ...65 78 Remote control code...
Страница 70: ...68 78 Wiring diagram...
Страница 73: ...71 78 Connection Schematic...
Страница 74: ...72 78 Wiring diagram...
Страница 78: ...76 78 Connection Schematic...
Страница 79: ...77 78 Wiring diagram...