bluetooth - Characters not properly displayed in serial monitor in arduino -
can tell me why characters not getting printed in serial monitor of arduino? pasting arduino code.
#include <softwareserial.h> #include <liquidcrystal.h> // initialize library numbers of interface pins liquidcrystal lcd(12,11,5,4,3,2); int bluetoothtx = 15; int bluetoothrx = 14; softwareserial bluetooth(bluetoothtx, bluetoothrx); int incomingbyte; void setup() { pinmode(53, output); serial.begin(9600); lcd.begin(16, 2); lcd.clear(); bluetooth.begin(115200); // bluetooth mate defaults 115200bps delay(320); // important delay! (minimum ~276ms) bluetooth.print("$$$"); // enter command mode delay(15); // important delay! (minimum ~10ms) bluetooth.println("u,9600,n"); // temporarily change baudrate 9600, no parity bluetooth.begin(9600); // start bluetooth serial @ 9600 lcd.print("done setup"); } void loop() { lcd.clear(); serial.print("in loop"); //read bluetooth , write usb serial if(bluetooth.available()) { serial.print("bt here"); char tosend = (char)bluetooth.read(); serial.print(tosend); lcd.print(tosend); delay(3000); }delay(3000); }
can take it. not print character provide instead prints else 'y' 2 dots on top etc. tried available solution.
your issues 1 of couple things. first , easiest check common ground. did connect rx , tx pins or gnd (ground) pin? make sure ground bt mate connected arduino ground.
if have done that, issue baud rate. i'm pretty sure softwareserial can't read @ baud rates beyond 57600. arduino.cc docs can read @ 115200, other places write 115200.
to test this, either need change settings on bluetooth mate or use mega or leonardo have hardware serial port (other 1 used usb) should able configure 115200.
if try hardware serial either on mega or using ftdi or , messages still garbled perhaps bluetooth mate not configured talk @ 115200 claims. trying reading docs or testing other baud rates.
Comments
Post a Comment