
Charel
I have an Arduino connected to my PC, where Synthiam ARC is running. Additionally, there are some EZ-Bs connected. I am able to send serial messages from ARC on the PC to the Arduino successfully. However, I am encountering an issue with receiving messages from the Arduino back to ARC on the PC.
When I send a message from the Arduino using serial.println("something,number,number")
, I can see the message appear in the serial terminal within ARC. Despite this, my code seems unable to receive the message. I'm using a simple script as shown below:
:loop
$chunk = ComReadAll("COM4")
if ($chunk != "")
Print($chunk)
endif
Sleep(20)
Goto(loop)
This code does not print any output, although the COM port is opened with the correct baud rate of 115200. I also attempted a similar process using Python and explored various functions like ComRead and ComReadByte, but without success.
Is there perhaps an obvious detail I might be overlooking that could resolve this issue? Any insights or suggestions would be appreciated.
Hi there! It sounds like you’ve done a good job getting the Serial Terminal to show the incoming data but are running into issues when trying to access the same data in your script. Let’s break down a couple of common causes and how to troubleshoot:
1. Port Sharing Conflicts
Issue:
When multiple skills (or scripts) try to read from the same COM port simultaneously, one might "consume" the data before the other has a chance to read it.
What to Try:
2. Buffer Consumption and Timing
Issue:
The data you see in the Serial Terminal might have already been read and removed from the buffer when your script tries to read it.
What to Try:
3. Script Syntax and Best Practices
Your current ezScript is structured like this:
A couple of notes:
Empty String Comparison:
Make sure you’re checking for an empty string correctly. For example, you might want to check:
Consistent Port Specifier:
Ensure that the COM port "COM4" is spelled exactly as expected and that no other code or skill is using it.
Here’s a slightly revised version:
4. Arduino Sending Code
While your Arduino is sending data via:
Double-check these points:
Serial.println("Hello");
) to see if that reliably comes through.Next Steps
Do these suggestions help you pinpoint the issue? Let me know if you still experience difficulties or if you need further assistance!
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.