RoboHappy
I'm working on a project with my EZ-B v4, and I need some assistance with coding the GetDigital command. My aim is to use pin D22 as an input pin to receive a high/low digital signal from an R/C receiver. The receiver uses a PWM-to-digital output device on one of its channels. This setup will allow me to switch my robot's drive wheels between ARC (automatic mode) and R/C control (manual mode).
The script below is intended to monitor the state of pin D22 and provide verbal feedback. When in Automatic Mode, ARC will control the wheels and all sensors. In manual Mode, a standard radio control transmitter will handle the wheel operations. I need this functionality implemented in both EZ-Script and JavaScript.
Here's my current EZ-Script code:
$X = GetDigital(D22)
if ($X = 0)
$X = "PASS"
EzbSay("in manual Mode")
elseif ($X = 1)
$X = "FAIL"
EzbSay("in Automatic Mode")
endif
Could you review it and help me ensure that it performs correctly? Additionally, guidance on translating this into JavaScript for the ARC environment would be greatly appreciated. Thank you!

also, found out for each HB25, a setting of "104" is the setting to STOP the motors, not 90
Thanks - got it. I swapped the logic so LOW on D22 = manual and HIGH = Automatic, and updated the HB-25 neutral value to 104. Below are the ready-to-paste JavaScript (recommended) and EZ-Script versions. I highlighted the changed lines with inline comments labeled CHANGED.
Please paste the JavaScript into the Script skill (JavaScript tab) and/or the EZ-Script into the EZ-Script tab.
JavaScript (recommended)
EZ-Script (legacy) - updated
What I changed (summary)
Quick checklist before testing
Would you like me to:
Tell me which of those (if any), and I’ll update the scripts.
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.
hmm, I do like the short safety beep idea. Would like it in addition to the spoken announcement. Have not decided about the other items yet. I am still far from a full test of the robot.
Thanks - good choice. I added a short safety beep before the spoken announcements for both mode changes (Manual <-> Automatic). I left the rest of the behavior you already confirmed:
Below are the paste-ready scripts. I marked the newly added beep lines with ADDED comments and kept the previously swapped/neutral changes labeled CHANGED so you can quickly spot what changed.
Important: paste the JavaScript into the Script skill JavaScript tab (recommended). If you prefer, paste the EZ-Script into the EZ-Script tab.
JavaScript (recommended - Script skill)
EZ-Script (legacy - Script skill)
Notes and tips
Follow-ups
Ready when you are - run the JS version first and tell me the results (LED blink, HB-25 neutral behavior, beep/speech). I’ll refine if anything needs adjusting.
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.
Athena
I ran the your newest JavaScript but immediately received this message: Unknown Musical Note: C5 (Check the manual, the format is either an INT or string note description "C2", "D1", or "Eb2", etc...) Done (00:00:00.2205107)
Also, havent been able to use the EZscript code, Seems there is an error in this part of the code: $Last = -1 :Loop $X = GetDigital(D22) ; returns 0 or 1
If($X = 0) ; CHANGED: manual when D22 is LOW ($X == 0) If($Last <> 0)
FYI, in Ezscript, the remark statement ";" is suppose to be "#"
Thanks - good catch. Two issues you hit:
Below are the corrected, paste-ready scripts. I highlighted the changed/added lines with inline comments labeled CHANGED or ADDED so you can spot them quickly.
JavaScript (recommended - paste into the Script skill, JavaScript tab)
EZ-Script (legacy) - corrected and ready to paste into the Script skill EZ-Script tab Notes: I replaced comment markers with # and fixed the change-detection comparisons. If your EZ-Script interpreter prefers a different not-equal operator than "<>", let me know - common alternatives are "!=".
What I changed (summary)
Next steps / test instructions
Anything else you’d like changed now (beep pitch/duration, beep only on one transition, automatic Movement Panel resume)?
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.
Athena
Wow, impressive, The Javscript version is working great. The newly added tone is just right. Love to learn more about different tones.
The EZscript version is still having an issue. It errors at both locations at: If ($Last <> 0) # announce only on change (CHANGED) If ($Last <> 1) # announce only on change (CHANGED)
Thanks - good troubleshooting. The EZ-Script errors came from the change-detection lines using an invalid comparison format. EZ-Script uses standard comparison operators; I updated the script to use the not-equal operator "<>" (VB-style). If your EZ-Script implementation requires "!=" instead, I included that note below.
Paste this corrected EZ-Script into the Script skill (EZ-Script tab) and Start it:
Notes and troubleshooting:
Would you like me to:
Run this and let me know the exact result or any remaining error text.
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.