I have my BT module working now with my Teensy 2.0.
I can pass individual characters, or bytes, across but I am not handling strings correctly.
As a test, I want to send a character string via BT to serial UART, to the Teensy.
How do I read strings from the serial port, not knowing ahead of time how long the string will be?
I can pass individual characters, or bytes, across but I am not handling strings correctly.
As a test, I want to send a character string via BT to serial UART, to the Teensy.
How do I read strings from the serial port, not knowing ahead of time how long the string will be?
HTML:
/* Teensy 2.0 UART test with BT module.
This code takes a serial input from the BT module,
modifys the test, and then spits it back out via
serial to the BT module, as char format data. This tests BT connectivity
and the interfacing between the BT module and Teensy 2.0
*/
String inByte = 'Nyet!'; // incoming string
// This line defines a "Uart" object to access the serial port
HardwareSerial Uart = HardwareSerial();
void setup() {
Uart.begin(9600);
}
void loop() {
if (Uart.available() > 0) {
inByte = Uart.read();
Uart.print("Here it is, fatso!!! : ");
Uart.println(inByte);
}
}