/* * Bluetooh Basic: LED ON OFF - Avishkar * Coder - Mayoogh Girish * Website - http://bit.do/Avishkar * Download the App : https://github.com/Mayoogh/Arduino-Bluetooth-Basic * This program lets you to control a LED on pin 13 of arduino using a bluetooth module */ #include char data = 0; //Variable for storing received data SoftwareSerial mySerial(0, 1); // RX, TX void setup() { mySerial.begin(9600); //Sets the baud for serial data transmission pinMode(13, OUTPUT); //Sets digital pin 13 as output pin pinMode(7, OUTPUT); pinMode(8, OUTPUT); } void loop() { if(mySerial.available() > 0) // Send data only when you receive data: { data = mySerial.read(); //Read the incoming data & store into data if(data == '1') { // Checks whether value of data is equal to 1 digitalWrite(13, HIGH); //If value is 1 then LED turns ON digitalWrite(7, HIGH); digitalWrite(8, HIGH);} if(data == '0') { // Checks whether value of data is equal to 0 digitalWrite(13, LOW); //If value is 0 then LED turns OFF digitalWrite(7, LOW); digitalWrite(8, LOW);} } }