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!

ok, great, I will try this version, very promising .
I like the LED states you created for me, I plan on keeping them.
Just for an extra, I would like to see this small test script that I can toggle $AllowAutoReconnect manually as you mentioned.
Great - glad you liked the LED states. Below are two tiny JavaScript Script-skill snippets you can paste into ARC’s Script skill (JavaScript tab). One toggles $AllowAutoReconnect and announces the new state. The other just prints/shows the current state (useful to check without toggling).
Instructions (quick)
Toggle script (one-shot)
Status script (non-destructive)
Extra tips
Want the button instructions or a single script that toggles and then updates an on-screen indicator (or file log) automatically?
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.
Ok, so I fixed the code in the connection skill and removed that extra EZB connect skill. Added your new combined EZB reconnect + D22 monitor JS.
It does run alot better. The LED blink is back, im happy. Only had a couple disconnects.
First disconnect only happened shortly after I switched from manual to automatic mode. So I reconnected, and I think ARC got confused because it announced it was in manual mode but was really still in automatic mode. Here is the error message inside the EZB_D22 script:
6:41:14 PM - Mode change -> AUTOMATIC detected (D22=1). Running HB25 Init and resuming automatic control. Wednesday, December 24, 2025 6:41:20 PM - Mode change -> manual detected (D22=0). Releasing servos and stopping automatic movement. Wednesday, December 24, 2025 6:41:21 PM - EZB index 0 not connected. Attempting to connect. Done (00:00:36.0940815)
It did settle down right after.
My second disconnect happened while I am writing this (while in Automatic mode)
Meanwhile I will also try the two toggle autoreconnect scripts just created.
One thing I forgot to add, sometimes when it reconnects itself, I noticed that I have to click on Start button of the EZB_D22 script for it wo announce what state it was it last.
Just tried both of the Toggle Auto Connect scripts, neither on work, due to some syntax error: Error: Missing 1 closing statement (ENDIF/ENDREPEAT/ENDREPEATUNTIL/ENDREPEATWHILE/etc) Done (00:00:00)
Thanks - that error message explains what happened. The "Missing 1 closing statement" is the EZScript parser complaining because JavaScript was put into an EZScript editor (or run via the EZScript Console). Your toggle snippets are JavaScript - they must be placed in the Script skill JavaScript tab (not the EZScript tab or EZScript Console).
Below I’ll give:
Why you saw the syntax error
Why the monitor sometimes needs Start clicked after reconnect
If you want the merged monitor to always start (and re-start) when you connect:
Important checks / remedies to reduce disconnects when switching modes
Next steps I suggest
If you want, I can:
Which would you like next?
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.
Im beginning to think alot of my issues are network connection related. I recently added the PandoraBot skill to this project to see. This laptop/tablet does not have a LAN port, its strictly wifi. So as I have described before, I use the built in wifi to connect to EZB (seems to work best) and a wifi dongle to connect to the internet ( I can use built in wifi to get to internet when not dongle is not in use). Many times, while having ARC running, if I try to call up a web page (ie:synthiam) it takes forever to load or never load unless I disonnect ARC or ARC disconnects itself. I also would note, when I think things are stable, when trying to use Pandorabot as a test, many times it may reply, only to lose it connection next time, then maybe work again if the ARC program works again (from be reconnecting if it had disconnected). I have also done a test with using one of the more simple JS we created. I could leave the ARC program running and connected to the EZB idle, no disconnects and I could toggle the D22 line and still no disconnects (usually the disconnects can start quickly). I am thinking that this laptop may not like the two wifis working together, which I absolutely need for this project. So yeah, I need to come up with another plan. It may be to use ARC to run robot but not AI skills, and/or use ARC for AI skills but no without any robot actions. Any thoughts?
Good troubleshooting - your description matches a common dualWiFi problem: when your PC connects to the EZ-B AP and your internet dongle at the same time, Windows can switch routes and default gateway in a way that breaks internet access or causes frequent network reconfiguration. ARC, PandoraBot (and any Internet skill) rely on a stable internet route; frequent adapter switching or a bad default route will cause the intermittent replies and disconnects you’re seeing.
Below are practical options (ranked by how well they solve the root problem), concrete steps you can try on Windows, and simple alternatives if changing networks isn’t possible. Tell me which OS version you have (Windows 10 / 11), what adapter names show in Network Connections, and whether the EZB is currently in AP mode (192.168.1.1) or client mode - I’ll tailor exact commands for you.
Recommended solutions (best fallback)
Option B - Assign a static IP to the EZB adapter and add a persistent route to EZB
Why Option B is effective: If the EZB network gives the PC a default gateway, Windows may route all traffic through it (and there’s no internet there). Setting no gateway on that adapter prevents it from becoming the default route; the static route ensures the EZB is still reachable.
Quick checklist you can try now
If you want, I’ll:
Which do you want to try first - set EZB to client mode, or I give the static IP + route steps for your current AP + twoadapter setup?
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.