Hi I am using Arduino Mega, My project is based on replacing wire connection with Bluetooth connection between hardware device and pc. Hardware device every ten seconds send me a signal data which I have to collect and display on PC. I manage to read this signal on the arduino by using 232 USB Converter and serial communication. Looking at serial monitor I am able to see the signal which the hardware device send to the PC but now I have to be able to connect Bluetooth to send this data from arduino to PC. Using the cable connection between Arduino and PC and Lab view I am able to display data which is working correctly, but when I am trying to add Bluetooth device my serial communication is not working correctly. The problem is that I receive zeros or nothing when I trying to use Tx1 and Rx1 Any Ideas what could be wrong. Thanks for or replays
Any Ideas what could be wrong.
Your software or your hardware. There's not much else that be wrong. Of course, since you posted no code and said nothing useful about the bluetooth device, all we can offer is sympathy. Good luck.
byte val=0;
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
}
void loop()
{
if (Serial.available()>0);
{
val=Serial.read();
Serial1.write(val);
}
if (Serial1.available()>0)
{
val=Serial1.read();
Serial.write(val);
}
}
That the code which I am using to read signal.
I check Bluetooth itself and it is working fine Using Realterm I am able to send some character between Bluetooth it is just when I am trying to send data from hardware so it could be my code
Using Realterm I am able to send some character between Bluetooth
I have no idea how you can send characters BETWEEN one device.
If you aren't going to tell us anything about the bluetooth device, I'll drop out of the discussion.
I have one Bluetooth Connected to the arduino -Linvor HC06 and standard Bluetooth boundle for PC. Linvor Bluetooth is connected to the vlotage regulator because it is operating on 3.3V and then is connected to RX1 and TX1. Hardware Device is connected to RX0 and TX0 All I have to do is to be able to pass data from TX0 and RX0 to the TX1 and RX1 than Linvor unit will transmit this data to PC where I have Lab View program created to display data. Bluetooth Linvor is appearing in my computer and is connected as COM8. Let me know what else I could say to get you more familiar with my problem
Another Thing which I just find out is that I can't use Serial , it has to be serial1 and serial2. otherwise signal is not appearing in serial monitor.
byte val=0;
void setup()
{
Serial1.begin(9600);
Serial2.begin(9600);
}
void loop()
{
if (Serial1.available()>0);
{
val=Serial1.read();
Serial2.write(val);
}
if (Serial2.available()>0)
{
val=Serial2.read();
Serial1.write(val);
}
}
This is the code which display the data on the serial monitor but it not works with Bluetooth.
This is the code which display the data on the serial monitor
Not possible. On the Mega, the USB cable is connected to the Serial instance, which is also connected to pins 0 and 1. Since you never read from, or write to, Serial, nothing is going to appear on the Serial Monitor, unless you are using something other than the USB cable to connect the Mega to the PC.
I already sort this out there was two mistakes. First of all my hardware device was connected TX to RX and RX to TX but it supposed to be RX to RX and TX to TX and also in my code after if statement I had semicolons so it never go to my declaration. Now everything is working fine. Any way thanks a lot for Your help!