
5 Add Libraries 71
5.1 What is Library? ............................................. 71
5.2 Add libraries ............................................... 71
6 For Mega2560 User 77
6.1 Lesson 1 Blinking LED ......................................... 77
6.2 Lesson 2 Flowing LED Lights ...................................... 83
6.3 Lesson 3 Controlling LED by Button .................................. 89
6.4 Lesson 4 Doorbell ............................................ 93
6.5 Lesson 5 Tilt Switch ........................................... 99
6.6 Lesson 6 Relay .............................................. 103
6.7 Lesson 7 RGB LED ........................................... 108
6.8 Lesson 8 Controlling an LED by Potentiometer ............................. 114
6.9 Lesson 9 Photo resistor .......................................... 123
6.10 Lesson 10 Servo ............................................. 128
6.11 Lesson 11 LCD1602 ........................................... 132
6.12 Lesson 12 Thermistor .......................................... 138
6.13 Lesson 13 Ultrasonic ........................................... 144
6.14 Lesson 14 Infrared-Receiver ....................................... 150
6.15 Lesson 15 Humiture Sensor ....................................... 155
6.16 Lesson 16 Joystick PS2 ......................................... 161
6.17 Lesson 17 7-Segment Display ...................................... 165
6.18 Lesson 18 74HC595 ........................................... 171
6.19 Lesson 19 Stepper Motor ......................................... 176
6.20 Lesson 20 Simple Creation-Stopwatch ................................. 182
6.21 Lesson 21 Simple Creation-Answer Machine .............................. 191
6.22 Lesson 22 Simple Creation-Small Fan .................................. 198
6.23 Lesson 23 Simple Creation - Digital Dice ................................ 203
7 For Uno User 209
7.1 Lesson 1 Blinking LED ......................................... 209
7.2 Lesson 2 Flowing LED Lights ...................................... 217
7.3 Lesson 3 Controlling LED by Button .................................. 222
7.4 Lesson 4 Doorbell ............................................ 229
7.5 Lesson 5 Tilt Switch ........................................... 234
7.6 Lesson 6 Relay .............................................. 237
7.7 Lesson 7 RGB LED ........................................... 242
7.8 Lesson 8 Controlling an LED by Potentiometer ............................. 250
7.9 Lesson 9 Photo resistor .......................................... 258
7.10 Lesson 10 Servo ............................................. 264
7.11 Lesson 11 LCD1602 ........................................... 268
7.12 Lesson 12 Thermistor .......................................... 274
7.13 Lesson 13 Ultrasonic ........................................... 280
7.14 Lesson 14 Infrared-Receiver ....................................... 286
7.15 Lesson 15 Humiture Sensor ....................................... 291
7.16 Lesson 16 Joystick PS2 ......................................... 297
7.17 Lesson 17 7-Segment Display ...................................... 301
7.18 Lesson 18 74HC595 ........................................... 306
7.19 Lesson 20 Stepper Motor ......................................... 312
7.20 Lesson 20 Simple Creation-Stopwatch ................................. 317
7.21 Lesson 21 Simple Creation-Answer Machine .............................. 327
7.22 Lesson 22 Simple Creation-Small Fan .................................. 332
7.23 Lesson 23 Simple Creation - Digital Dice ................................ 337
ii