p5.serialserver
p5.serialserver copied to clipboard
Using a different baud rate
Everything works fine at 9600 baud, but if I change the baud rate to some higher value in both my js script and on the micrcontroller, the communication does not work. The problem appears to be that the server automatically is configured to use 9600 baud. How can I change this on the server?
Hello,
Arduino : Serial.begin(115200) (115200 for example)
In sketch : let portName = 'COM6'; (if COM6 is the port of Arduino connected) let options = {baudRate: 115200}; ... serial.open(portName,options);
I hope that's helpul
I'm running into a problem. Whenever the baudrate of the arduino and p5serialport is set to 9600, everything works fine. I'm sending 32 0's or 1's terminated with a newline ('\n').
However, when I set both to 115200, serial communication is seen, but it's all empty.
Nothing in either files has changed except for the baudrate.
I'm running a slightly edited version of the basics example.
I've tried the way that @DottyJS mentioned, as well as serial.open(portName, {baudrate: 115200}, onOpen as mentioned as being a valid example in p5.serialport.js.
What's wrong?
Edit: After some digging, I think it's to do with the fact that I'm using the GUI app for p5 serialcontrol, in which I can't specify the baud rate. I'll have a look if I can change and compile a better version.
Edit2: As a workaround, you can change the baudrate at which the p5.serialcontrol app interfaces with the arduino. I found out how to change the baudrate, which is hardcoded. Granted I'm on a mac, here's what you do:
-Go to your applications folder and look for p5.serialcontrol.app -Right click, show package contents -Navigate to /Contents/Resources/app/node_modules/@serialport/stream -Open stream.js with a text exitor of your choice -Change the baudrate from 9600 to one of your choice (I chose 115200). -Save and close -Open p5.serialcontrol as usual -Of course, your arduino or similar should also communicate at the baudrate that you set.