#include //Include SoftwareSerial library SoftwareSerial myBLUETOOTH(0, 1); //define SoftwareSerial RX first then TX #define LED 3 // Define on board LED connected to pin 3 char state; // Define a variable to save the reads char void setup() { myBLUETOOTH.begin(9600); // Begin SoftwareSerial pinMode(LED, OUTPUT); // sets LED pin as OUTPUT pin } void loop() { if (myBLUETOOTH.available()) { // if SoftwareSerial recived any data state = myBLUETOOTH.read(); //Reads the received char and store it at "state" if (state == '1') // If you recived Y digitalWrite(LED, HIGH); //Turn LED on if (state == '2') { // If you recived n digitalWrite(LED, LOW);//Turn LED off } } }