-
Notifications
You must be signed in to change notification settings - Fork 0
/
hacklab-ArduinoComic-Page-11.html
66 lines (66 loc) · 1.82 KB
/
hacklab-ArduinoComic-Page-11.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-type"/>
<meta content="en-us" http-equiv="Content-Language"/>
<title>
/hacklab-ArduinoComic-Page-11
</title>
</head>
<body>
PAGE 11: Digital output
<br/>
Panel 41:
<br/>
Drawing: Breadboard attached to Arduino with LED attached
<br/>
(In text panel): The anode is connected to pin 2 on the Arduino through a 220 ohm resistor. The cathode is connected to ground. Pins 2 through 13 can be configured as digital inputs or outputs. Click new button to start a sketch.
<br/>
<br/>
Panel 42:
<br/>
Drawing: Script on white shape
<br/>
void setup() {
<br/>
pinMode(2, OUTPUT);
<br/>
}
<br/>
void loop() {
<br/>
digitalWrite(2, HIGH);
<br/>
delay(500);
<br/>
digitalWrite(2, LOW);
<br/>
delay(500);
<br/>
}
<br/>
(In text panel): In setup, we set pin 2 to be an output. In loop, first we set pin 2 high which lights the led. Delay pauses 500 milliseconds, or half a second. When pin 2 is set low, the LED goes off, we pause another half second.
<br/>
<br/>
Panel 43:
<br/>
Drawing: buttons on Arduino IDE interface. Text labels buttons with pointing arrows (red 10 pt type bold)
<br/>
Labels:
<br/>
Verify button
<br/>
Upload button
<br/>
(In text panel): Click verify on the menu to check your code. If there aren’t any errors, click upload to put your program on the Arduino.
<br/>
<br/>
Panel 44:
<br/>
Drawing: 2 panels, LED glows on, LED off
<br/>
(In text panel): The LED blinks on for half a second, then blinks off for half a second, over and over again.
<br/>
<br/>
</body>
</html>