Home
Elegoo
Controller
Mega2560
Page 63
Elegoo Mega2560 - Page 63
224 pages
Manual
Save Page as PDF
To Next Page
To Next Page
To Previous Page
To Previous Page
Loading...
63
/
223
{
digitalWrite(ledPin,
LOW
);
}
}
In the 'loop' function there are two 'if' statements. One for each button. Each
does
an 'digitalRead' on the appropriate
input.
Remember
that
if
the
button
is
pressed,
the
corresponding
input
will
be
LOW,
if
button A is low, then a 'digitalWrite' on the ledPin turns it
on.
Similarly, if button B is pressed, a LOW is written to the
ledPin.
Example p
icture
62
64
Table of Contents
Main Page
Packing List
4
Content
10
Lesson 0 Installing IDE
12
Installing Arduino (Windows)
14
Installing Arduino (Mac os X)
21
Installing Arduino (Linux)
22
Lesson 1 Add Libraries and Open Serial Monitor
23
Importing a .Zip Library
25
Manual Installation
27
Arduino Serial Monitor (Windows, Mac, Linux)
28
Making a Connection
29
Settings
31
Pros
31
Lesson 2 Blink
32
Lesson 3 LED
43
Resistors
45
Connection Schematic
47
Wiring Diagram
48
Lesson 4 RGB LED
50
Component Introduction
51
Theory (PWM)
54
Connection
55
Code
57
Example Picture
58
Component Required
59
Lesson 5 Digital Inputs
59
Lesson 6 Active Buzzer
64
Lesson 7 Passive Buzzer
68
Lesson 8 Tilt Ball Switch
72
Lesson 9 Servo
76
Lesson 10 Ultrasonic Sensor Module
80
Lesson 11 Membrane Switch Module
85
Lesson 12 DHT11 Temperature and Humidity Sensor
91
Lesson 13 Analog Joystick Module
97
Lesson 14 IR Receiver Module
102
Lesson 15 MAX7219 LED Dot Matrix Module
108
Lesson 16 GY-521 Module
112
Lesson 17 HC-SR501 PIR Sensor
121
HC SR501 PIR Functional Description
123
HC SR501 View Area
124
PIR Range (Sensitivity) Adjustment
124
HC SR501 Sensitivity Adjust Time Delay Adjustment
124
HC SR501 Time Delay Adjustment
125
Trigger Mode Selection Jumper
126
HC-SR501 Dance Floor Application Examples
126
Lesson 18 Water Level Detection Sensor Module
131
Lesson 19 Real Time Clock Module
136
Lesson 20 Sound Sensor Module
141
Lesson 21 RC522 RFID Module
147
Lesson 22 LCD Display
152
Lesson 23 Thermometer
157
Lesson 24 Eight LED with 74HC595
162
Lesson 25 the Serial Monitor
169
Lesson 26 Photocell
175
Lesson 27 74HC595 and Segment Display
180
Lesson 28 Four Digital Seven Segment Display
186
Lesson 29 DC Motors
191
Lesson 30 Relay
202
Lesson 31 Stepper Motor
207
ULN2003 Driver Board
210
Lesson 32 Controlling Stepper Motor with Remote
215
Lesson 33 Controlling Stepper Motor with Rotary Encoder
219
Rotary Encoder
220