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

SoftwareSerial BTSerial(10, 11);  // RX, TX

                 void setup() {
                   Serial.begin(9600);

                   BTSerial.begin(9600);

                 }



                 void loop() {

                   if (BTSerial.available()) {

                     char command = BTSerial.read();
                     Serial.println(command); // Print received data

                   }

                 }



                      REVISIT


                   ▶   IoT connects everyday devices to each other or the internet.
                   ▶   Bluetooth is ideal for short-range wireless control, perfect for home or classroom projects.
                   ▶   Block-based code can handle Bluetooth messages by checking incoming text and toggling pins accordingly.

                   ▶   Smartphone-Controlled Lamp: A straightforward project to practice sending commands and changing LED
                     colors.








































                                                                           Introduction to IoT & Wireless Communication  117
   114   115   116   117   118   119   120   121   122   123   124