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

BUILDING AND TESTING THE SMART LAMP SYSTEM


                  Integrating the System

                  ●  Steps to Combine the Circuit and App:

                      Step 1   Power on the Arduino circuit.
                      Step 2   Pair  the smartphone with HC-05 via

                            Bluetooth settings.
                      Step 3   Open the app and test the buttons to turn
                            the LED ON/OFF and change colors.


                  PROGRAMMING THE FINAL ARDUINO CODE

                  #include <SoftwareSerial.h>

                  SoftwareSerial BTSerial(10, 11);



                  #define RED 3

                  #define GREEN 5

                  #define BLUE 6



                  void setup() {

                    Serial.begin(9600);

                    BTSerial.begin(9600);
                    pinMode(RED, OUTPUT);

                    pinMode(GREEN, OUTPUT);



                  120   Premium Edition-VIII
   117   118   119   120   121   122   123   124   125   126   127