char val; // variable to receive data from the serial port(bluetooth) void setup() { // Start serial communication at 57600 Serial.begin(57600); pinMode(13, OUTPUT); } void loop() { if(Serial.available()) { val = Serial.read(); switch(val) { case 't': // LED On digitalWrite(13,HIGH); break; case 'f': //LED Off digitalWrite(13,LOW); break; } } }