Page 103 - KEC Khaitan C8.2 Flipbook
P. 103

Step  3   Writing and Uploading a Basic Sketch

                              Open the Arduino IDE and write a simple sketch to control the three LEDs (block code
                              from Tinkercad may be downloaded and used here).

                             Upload the code to the Arduino Uno using a USB cable.

                 Step  4   Building a Traffic Light System
                             Circuit Design and Assembly:

                              o  Place LEDs on the breadboard, and connect resistors to their anodes.

                              o  Wire the LEDs to Arduino pins (red = pin 8, yellow = pin 9, green = pin 10).

                              o  Connect the breadboard's ground and power rails to the Arduino.


















                                               Circuit Design                             Hardware Design


                 Bonus Challenge:

                 Add a pedestrian crossing button using a push button.
                 Program the traffic lights to pause and allow pedestrians to cross when the button is pressed.


                 Important Notes:

                 Always double-check connections before powering the circuit.
                 Debugging is part of the learning process. Use the Arduino Serial Monitor to check for errors.

                 Ensure resistors match the LED's voltage and current ratings to prevent damage.


                 Troubleshooting Tips:

                 If LEDs don't light up, check:
                     o  LED polarity (anode and cathode connections).

                     o  Resistor values (ensure they are not too high or low).

                     o  Arduino code (ensure pins are correctly defined).








                                                                                                 Hands-On Project  101
   98   99   100   101   102   103   104   105   106   107   108