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!

Thanks - this is a good use case. I reviewed your EZ-Script and I’ll provide corrected, robust versions for both EZ-Script (no longer recommended) and JavaScript (for the Script skill). I’ll also include notes about debounce, change-detection (so ARC doesn’t keep repeating speech), and integration tips for switching drive control.
*Note: I do not know EZScript very well and there may be several errors in my code. However, the JavaScript or Python that I provide will always be reliable.
Useful links
Key points before the code
Corrected EZScript (suitable for the Script skill)
Notes for EZScript:
JavaScript version (recommended when using Script skill)
Integration tips
A couple of questions to fine-tune the solution
If you post the exact hardware behavior for the RC output and the Movement skill name, I’ll give the exact ControlCommand calls and an updated script that will safely switch wheel control for you.
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.