Closed lobotou closed 8 months ago
Please edit this to complete the template you were shown when opening the issue.
As it is we have no information about which node or what the problem is.
Please Add all the information requested, not just the version numbers.
We need the following:
Please include details of how you have configured the serial port config node. Especially if you have included a value in the Add character to output messages
section as I believe the arduino code you have provided will only work if a new line char is included in the output which will not be added by default, which will then lead to the default 1 second timeout on the serial.parseFloat()
function.
Also should you be using serial.parseInt()
as you appear to only be sending integers not floats.
I will guess that when you use the arduino IDE it is including a new line character (and possibility a line feed) with each number you send.
Please include details of how you have configured the serial port config node. Especially if you have included a value in the
Add character to output messages
section as I believe the arduino code you have provided will only work if a new line char is included in the output which will not be added by default, which will then lead to the default 1 second timeout on theserial.parseFloat()
function.请提供有关如何配置串行端口配置节点的详细信息。特别是如果您在Add character to output messages
部分中包含了一个值,因为我相信您提供的 arduino 代码只有在输出中包含新行字符(默认情况下不会添加)时才起作用,然后导致serial.parseFloat()
函数默认 1 秒超时。Also should you be using
serial.parseInt()
as you appear to only be sending integers not floats.您还应该使用serial.parseInt()
因为您似乎只发送整数而不是浮点数。
Your judgment is correct. I apologize for making a basic mistake. I added "\ n" to "Add character to output messages" and have resolved this issue.
I use node red "Serial port output" node to output a number to Arduino, but the response time is too long, about 500ms to 2s. I don't know if this is normal.
I send the number to arduino by Serial port, i hope that the arduino will response immediately. But when i click on the inject node or silder, the arduino did not response immediately, and after about 500ms to 2s, my arduino responsed and the led light up. I want to know why. Thanks!!!
Node-RED version:V3.1.3 node.js version: v20.11.0 npm version: 10.3.0 Platform/OS: window10 Browser: chrome 120.0.6099.225 Arduino :Uno R4
By the way. This is my arduino code, and i have tried to send the number to arduino by arduino IDE serial port, it is very quick that the led light up when i sent the number. So i think that is not arduino's problem.