Hi!
I am new to arduino and I am developing a project that consists in connect two bluetooth modules (one hc-05 and the other hc-06). The hc-05 is attach with a arduino mega board and the hc-06 is connected with a bitalino (board with an mcu nano). I already made the connection between the two modules, but only gives me random numbers. The bitalino have 4 analog outputs and i just want data from one.
This is the code:
#include <SoftwareSerial.h>
int bluetoothTx = 10; // TX-O pin of bluetooth mate,
int bluetoothRx = 11; // RX-I pin of bluetooth mate,
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps
bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps
bluetooth.print("$$$"); // Enter command mode
delay(100); // Short delay, wait for the Mate to send back CMD
bluetooth.println("U,9600,N"); // Temporarily Change the baudrate to 9600, no parity
// 115200 can be too fast at times for NewSoftSerial to relay the data reliably
bluetooth.begin(9600); // Start bluetooth serial at 9600
}
void loop()
{
if(bluetooth.available())
{
Serial.print((byte)bluetooth.read();
}
if(Serial.available())
{
byte c = (byte) Serial.read();
bluetooth.print(c);
}
}
Kudos for using code tags, but this doesn't compile:
Serial.print((byte)bluetooth.read();
is missing a ")". A small detail, but it indicates you've edited since your last compile, which means we're not seeing the code that you feel isn't working.
C
The bitalino information is a start but I can't really make sense of it other than there are 8 bytes . It might help to understand the output better if you can set up to print each byte received in HEX with a space in between.