SWITCH VIA BLUETOOTH

Bluetooth analog

 

/*

Through Bluetooth we can send signals to turn off or turn on a lamp or equipment.

*/

char INBYTE;

int LED = 13;

void setup() {

Serial.begin(9600);

pinMode(LED, OUTPUT);

}

void loop() {

Serial.println(“Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:”);

while (!Serial.available());

INBYTE = Serial.read();

if( INBYTE == ‘0’ ) digitalWrite(LED, LOW);

if( INBYTE == ‘1’ ) digitalWrite(LED, HIGH);

delay(50);

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s