Hello everyone,
Im just starting a project using my home made Nucelo and I am planning to use both its serial ports. So serial is going to be quite a large part of the project. On one port is a LoRa module and on the other is a Nextion display. I fired up Mbed Studio and went to use Serial only to find out thats now out of date, so im forced to use Buffered Serial.
Is buffered serial the best way to go? It seems incredibly over engineered for most use cases and lacks any useful documentation or examples.
Does anybody know of any alternatives or ways around this?
Im trying to send commands to a Nextion display. This is essentially a line of text followed by 3 full bits (0xff). My code is below which i dont think is working cus its sending the full bits as text not just as ones. Any help would be great.
#include "mbed.h"
#define MAXIMUM_BUFFER_SIZE 64
static BufferedSerial serial_port(PB_6, PB_7); // tx, rx
int main() {
serial_port.set_baud(9600);
serial_port.set_format(
/* bits */ 8,
/* parity */ BufferedSerial::None,
/* stop bit */ 1);
while (1) {
serial_port.write("t0.txt=", 9);
serial_port.write("If", 2);
serial_port.write("0xff", 4);
serial_port.write("0xff", 4);
serial_port.write("0xff", 4);
wait_us(1000000);
}
}