You initialize the serial communication via USB with
where baudrate is a
long specifying the number of symbols you want to send over the connection per second. You can put pretty much any number in there, but not every number makes sense.
One thing that I found odd though is that I can't seem to actually use a different baudrate than 9600. The sketch compiles and uploads just fine, but if I check the actual speed of the serial port via
setserial -ag port
port is the port of my Teensy 4.0 board (that command is something you can use in the terminal of Linux) or with
directly in the sketch it always says 9600. I suspect that this is caused by something inside the code behind
Serial.begin() since I can manually set the baudrate via the terminal in Linux using
stty speed baudrate < port > port
baudrate is the speed I want to use and
port is the port of my board (checking it with the first terminal command: it works). But when restarting the program on the board the baudrate reverts to 9600.
Does anyone know why this is and how to fix this?