I'm trying to transmit data from my PC to an Arduino board. I'm able to see what the Arduino sends to the PC using Tera Term but I don't get any data from PC to Arduino. I've tried changing the pins and everything out there (even testing another bluetooth board). I'm using an Arduino Mega 2560.
Here is the code:
#include <AFMotor.h>
#include <NewPing.h>
#include <SoftwareSerial.h>
#define LED 52
#define RxD 17
#define TxD 14
SoftwareSerial blueToothSerial(RxD,TxD);
void setup() {
blueToothSerial.begin(9600);
blueToothSerial.println("Bluetooth On please press 1 or 0 blink LED ...");
pinMode(LED, OUTPUT);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
}
byte BluetoothData;
void loop()
{
if (blueToothSerial.available())
{
BluetoothData = blueToothSerial.read();
if(BluetoothData=='1'){ // if number 1 pressed...
digitalWrite(LED, 1);
blueToothSerial.println("LED On D13 ON ! ");
}
if (BluetoothData=='0'){ // if number 0 pressed...
digitalWrite(LED, 0);
blueToothSerial.println("LED On D13 Off ! ");
}
}
delay(100); // prepare for next data...
}