
PRO
Charel
Netherlands
Asked
I am experiencing an issue with my script that runs a loop while the EZ-B is not connected. Here is the code snippet I am using:
if (IsConnected(0) = true)
print("ping")
ToggleDigital(0.23)
endif
According to my understanding, the script should never print "ping" or toggle the digital port 23 because the EZ-B is not connected. However, I am still receiving a "ping" message followed by an error: "Unknown Digital Port: 0.23."
Could someone help me understand why this is happening and what I might be doing wrong?
Related Hardware EZ-B v4
It seems like there might be a misunderstanding in the script logic or the way the
IsConnected
function is being used. Let's break down the issue and provide a solution.Understanding the Issue
Function Usage: The
IsConnected
function checks if the EZ-B at a specified index is connected. The function should be used with the correct syntax and logic.Script Logic: The script is intended to execute certain actions only if the EZ-B is connected. However, the logic might be flawed, leading to unexpected behavior.
Error Message: The error message "Unknown Digital Port: 0.23" suggests that the port is being referenced incorrectly. Digital ports on the EZ-B v4 are labeled as
D0
toD23
, not0.23
.Solution
Let's correct the script and ensure it functions as intended. Here's a revised version using JavaScript, which is preferred over EZ-Script:
Key Points
EZB.isConnected(0)
to check if the EZ-B at index 0 is connected."D23"
to reference digital port 23 correctly.Additional Tips
print()
statements to debug and understand the flow of your script.If you have any further questions or need additional assistance, feel free to ask!
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.
you just wrote the same code but now in Javascript. What is different?
Athena was incorrect with her guidance.
The javascript manual for digital toggle is here: https://synthiam.com/Support/javascript-api/Digital/toggle A port for JavaScript is not in quotes.
The ezscript you posted syntax is incorrect. The port is not 0.23, it is 0.d23. The manual for ezscript is here: https://synthiam.com/Support/ez-script-api/ezscript
*Side note: It is essential to know that ezscript has bugs and is deprecated, as announced several years ago. Its existence in Synthiam ARC software is for backward capability. Learning Python or JavaScript is a good suggestion. Trust me when I say JavaScript is easier to read and understand than EZScript. Plus, there are several more resources. The manuals on this website in the support section for JavaScript are also necessary. By running the above code, when there is NO connection to an ezb, the following message states there is no EZB connected.
The EZB.isConnected() method is documented here: https://synthiam.com/Support/javascript-api/EZB/isConnected
Also, note that the EZB.isConnected() method does not connect to an EZB but merely returns its connection status.
Thank you, and good catch on the missing "D". It did not yet register with me that ezscript is EOL, and I could expect issues like IsConnected buggy. Plenty lines of code to recode, bummer. I will switch to python.
I think what happened is ezscript was meant for quick easy scripting back in the early days when ARC was ezbuilder. But since then, ARC implemented Python and JavaScript which are incredibly fast in comparison to ezscript. Those languages quickly outgrew ezscript - specifically in performance. We’re talking a 10x or more performance improvement over ezscript.
plus ezscript is too much like basic but also trying to be something else. It kind of is similar to JavaScript but not really. Learning ezscript doesn’t benefit anyone because it’s not a transferable skill either.
so several years ago we just sort of left it alone. We won’t kill it but it isn’t getting new features.