Hello I have a problem with this code and i cant seem to find the solution . Any help is appreciated .
#include <SoftwareSerial.h> //Software Serial Port
//Version 1
#define RxD 5 // This is the pin that the Bluetooth (BT_TX) will transmit to the Arduino (RxD)
#define TxD 6 // This is the pin that the Bluetooth (BT_RX) will receive from the Arduino (TxD)SoftwareSerial blueToothSerial(RxD,TxD);
//IO Declaration
void setup() {
//declaration
blueToothSerial.begin(9600);
Serial.begin(9600); // Allow Serial communication via USB cable to computer (if required)}
void loop() {char recvChar; //Variable to store received character
while(blueToothSerial.available()>0)
{
recvChar = blueToothSerial.read();
Serial.println(recvChar); // Print the character received to the Serial Monitor (if required)
//If the character received = 'a' , then turn on LED
if(recvChar=='a'){
digitalWrite(LED01, HIGH);
//Serial.println("a received. LED ON");
blueToothSerial.println("ON");
}else if ( recvChar=='b'){
digitalWrite(LED01, LOW);
// Serial.println("b received. LED OFF");
blueToothSerial.println("OFF");
}}//end while
}