Page 439 - 3-2
P. 439

void setup() {
              Serial.begin(9600);
              pinMode(15, OUTPUT);
              BTSerial.begin(9600);// set the data rate for the BT port
            }




            void loop() {


                byte data;
                data = BTSerial.read();
                if(data=='1'){
                  digitalWrite(15, HIGH);  // set the LED on
                  Serial.println("1");
               }
               else if(data=='0'){
                  digitalWrite(15, LOW);    // set the LED off
                  Serial.println("0");
                }


            }


















































                                                         - 439 -
   434   435   436   437   438   439   440   441   442   443   444