Asked

Help With EZ-Script Coding

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!


Related Hardware EZ-B v4
Related Controls Script EZ-Script Console

ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

#41  

AThena

I ran the newest script. I like it. I also created the separate HB25 Init script and decided to add the startup on connection skill :

controlCommand("HB25 Init", "ScriptStart"); sleep(500); // wait a bit, or remove if you don't need a delay controlCommand("HB25_D22_Monitor", "ScriptStart");

Things work fine as long as the wifi stays connected. I have been having alot of disconnects tonight which might be a wifi dongle related.

Author Avatar
PRO
Canada
#42  

Great - glad the startup sequence is working and you have the HB25 Init + monitor started from the Connection settings. Frequent WiFi disconnects are a common nuisance; here’s a practical troubleshooting checklist plus a ready-to-paste reconnection script (JavaScript) you can run as a small ARC Script skill to automatically recover, re-run HB25 Init, and restart your monitor when the EZ-B reconnects.

Quick checklist - common causes and fixes

  • AP vs Client mode
    • Are you using EZ-B in AP (direct PCEZB) or Client (EZB joins your router) mode? Client mode is more convenient but depends on router reliability; AP mode is more stable for single-PC setups.
  • WiFi dongle / PC USB + drivers
    • If you use a USB WiFi adapter on the PC, make sure drivers are up-to-date and USB power saving is disabled. Try another adapter (with external antenna) if possible.
  • Router and WiFi channel
    • Use 2.4 GHz for EZ-B (EZ-B v4 is 2.4GHz). Pick a fixed channel (1, 6, or 11) to avoid interference and disable auto-channel if possible.
    • Avoid channels with heavy interference from neighbors (use a WiFi analyzer on your phone/PC).
  • Signal strength / placement
    • Move router and robot closer to test. If the robot moves, consider steps to maintain RSSI.
  • Power supply stability
    • Voltage dips to the EZ-B (or servos drawing current) can cause resets and disconnects. Ensure batteries and wiring are healthy.
    • Enable the EZ-B power monitor in Connection settings unless you have a reason to override it.
  • EZ-B firmware & ARC
  • Router DHCP lease / IP changes
    • If IP changes frequently in Client mode, consider giving the EZ-B a static IP reservation in the router.
  • PC power saving
    • Disable WiFi power-saving on the PC (Device Manager adapter properties power management).
  • Logs
    • Watch the ARC Console and Connection skill status for timestamps when disconnects occur. That helps correlate disconnects with events.

Automatic reconnect script (JavaScript)

  • Create a new Script skill named "EZB_Reconnect" (Project Add robot skill Script).
  • Paste the code below into the Script skill JavaScript tab (NOT EZ-Script).
  • This script periodically checks EZB.isConnected(0). On disconnect it will try to reconnect via the Connection skill, and when reconnect succeeds it will:
    • Run HB25 Init (ScriptStartWait recommended)
    • Start your HB25_D22_Monitor script

Paste-ready code:

// EZB Reconnect Monitor (JavaScript) 
// Creates an auto-reconnect behavior for EZB index 0 and restarts HB25 Init + monitor on reconnect.
// Install as a Script skill (name doesn't affect behavior, but use a clear name like "EZB_Reconnect").

var ezbIndex = 0;                      // EZB connection index to monitor
var checkIntervalMs = 3000;            // how often we check connection (ms)
var connectAttemptWaitMs = 4000;       // how long to wait after asking Connection to Connect
var maxConnectAttempts = 6;            // attempts before backing off
var backoffMs = 15000;                 // backoff after repeated failures

// Names of the scripts to start after reconnect. Adjust to match your exact skill titles:
var hb25InitScriptName = "HB25 Init";
var monitorScriptName = "HB25_D22_Monitor";

// Helper: log with timestamp
function log(s){
  print((new Date()).toLocaleTimeString() + " - " + s);
}

// Ensure Connection skill is available - attempt loop
log("Reconnect monitor starting. Monitoring EZB index " + ezbIndex);

var consecutiveFailures = 0;

while(true){
  try {
    var connected = EZB.isConnected(ezbIndex);
    if(connected){
      // If connected, reset failures and sleep until next check
      consecutiveFailures = 0;
      sleep(checkIntervalMs);
      continue;
    }

    // Not connected - attempt reconnect
    log("EZB not connected. Attempting to connect (Connection.Connect" + ezbIndex + ")...");
    // Use  ControlCommand Connect0..Connect4 or ConnectAll depending on your setup
    // For index 0 use Connect0
    if(ezbIndex === 0) controlCommand("Connection", "Connect0");
    else if(ezbIndex === 1) controlCommand("Connection", "Connect1");
    else if(ezbIndex === 2) controlCommand("Connection", "Connect2");
    else if(ezbIndex === 3) controlCommand("Connection", "Connect3");
    else if(ezbIndex === 4) controlCommand("Connection", "Connect4");
    else controlCommand("Connection", "ConnectAll");

    // wait a bit for EZB to appear
    sleep(connectAttemptWaitMs);

    // check status
    if(EZB.isConnected(ezbIndex)){
      log("EZB reconnected. Running HB25 Init and starting monitor.");

      // run HB25 Init and wait for it to complete (recommended)
      try {
        controlCommand(hb25InitScriptName, "ScriptStartWait");
        sleep(300); // small settle
      } catch(e) {
        log("HB25 Init start/wait failed: " + e);
      }

      // start monitor script (async)
      try {
        controlCommand(monitorScriptName, "ScriptStart");
      } catch(e) {
        log("Starting monitor script failed: " + e);
      }

      // reset counters and continue monitoring
      consecutiveFailures = 0;
      sleep(1500);
      continue;
    } else {
      // failed to reconnect
      consecutiveFailures += 1;
      log("Reconnect attempt failed (count=" + consecutiveFailures + ").");

      if(consecutiveFailures >= maxConnectAttempts){
        log("Max attempts reached. Backing off for " + backoffMs + " ms.");
        sleep(backoffMs);
        consecutiveFailures = 0;
      } else {
        // small wait, try again quickly
        sleep(2000);
      }
    }
  } catch(err) {
    log("Exception in reconnect loop: " + err);
    sleep(5000);
  }
}

How to use

  • Name the Script skill (for example "EZB_Reconnect") and Start it.
  • The script will try to reconnect EZB index 0. If your EZB is at a different index, change ezbIndex accordingly.
  • Update the hb25InitScriptName and monitorScriptName if you used different exact skill titles.

Notes & tips

  • Connection skill also has Connection Established Scripts - you used that already. The above script adds extra resilience for situations where the EZ-B drops unexpectedly. The Connection-established scripts are still valuable for normal startup.
  • If your disconnects are frequent, run the reconnect script and also check ARC Console and router logs (time correlation helps find cause).
  • If disconnects always happen when you move the robot or when servos move, suspect power dips - verify battery and connections.
  • If your PC uses a USB WiFi dongle, try swapping to a known-good adapter or connect the PC with ethernet to remove PC WiFi as a variable while troubleshooting.
  • If you want I can:
    • Produce a version that posts the disconnect time and reason into a logfile (File.appendStringLine) for later analysis.
    • Add an emailed notification (via Web API) or push notification when repeated disconnects occur (if you want remote alerts).
    • Help craft a router-side static DHCP reservation or advise which USB WiFi adapters are known stable.

Follow-ups

  • Are you running the EZ-B in AP mode or Client mode (router)? Which PC OS and WiFi adapter are you using (internal or USB)? Any pattern to disconnects (e.g., when moving, at certain times)?
  • Want me to add logging to a file so you can collect disconnect timestamps for analysis?
  • Would you like the reconnect script to also attempt to restart ARC's connection skill via controlCommand("Connection","ConnectAll") instead of Connect0?

Tell me how you’d like to proceed and I’ll give the exact code/config for that next step.


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.
#43  

I always run my all EZBs in AP mode.

I'm running ARC on a Dell Latitude 7390 with Windows 11(64bit), some disconnects actually freeze the ARC program and I use Task Manger to totally shut the program down and recycle power to the EZB (I Notice ARC is listed as ARC(32Bit), is this a problem?

I use both the internal Wifi and an external Wifi  dongle to have internet access and connection to the EZB. My dongle is either the one that was supplied with my EZRobot InMoov Head kit or an X-Media NE-WN3201

I also get the disconnects even with just using the internal wifi (already checked that drivers are updated)

I would like to add that EZB Reconnect script and see what happens (adding a time stamp might be good idea too)

Author Avatar
PRO
Canada
#44  

Nice details - thanks. Running the EZ-B in AP mode on a Windows 11 laptop with both internal WiFi and a USB dongle can work well, but the mix of adapters, power saving, and drivers is often the root cause of the disconnects you’re seeing. Below I give:

  • Quick answers to your questions (ARC listed as 32-bit, AP mode notes).
  • A prioritized troubleshooting checklist you can try right away.
  • A ready-to-paste EZB reconnect Script skill (JavaScript) that restarts your HB25 Init and D22 monitor on reconnect and writes timestamped log lines to a file.
  • How to autostart that script from the Connection skill and next steps/questions.

Short answers

  • ARC listed as ARC (32-bit) on your Windows 11 (64-bit) machine is normal. ARC is a 32-bit application and that alone is not typically the cause of WiFi disconnects.
  • Frequent disconnects that freeze ARC more likely stem from the WiFi adapter(s) (driver, power management, USB power), the PC USB bus, or EZ-B power/firmware - not the 32-bit vs 64-bit label.
  • Running the EZ-B in AP mode is fine. If your PC uses two radios (internal + USB) to maintain both internet and EZ-B AP, conflicts or automatic switching may cause instability.

Troubleshooting checklist (practical order)

  1. Power and wiring first

    • Verify EZ-B power (battery/pack) voltage is stable and wiring solid. servo current draws can reset the EZ-B and cause disconnects.
    • If disconnects occur when servos move, suspect voltage dips.
  2. Disable WiFi power saving & USB selective suspend (Windows)

    • Device Manager Network adapters right-click your WiFi adapter(s) Properties Power Management uncheck "Allow the computer to turn off this device to save power".
    • Control Panel Power Options Change plan settings Change advanced power settings USB settings USB selective suspend setting Disable.
    • Reboot after making changes.
  3. Use a dedicated adapter for EZ-B AP

    • If you need internet + EZ-B AP, dedicate one radio (USB or internal) strictly to EZ-B and the other to Internet. Mixing them can cause Windows to re-route or adjust radio settings.
    • If possible: use Ethernet on the PC for internet and a single WiFi adapter dedicated to the EZ-B AP.
  4. Drivers & firmware

    • Update WiFi drivers (vendor site preferred) and update EZ-B firmware (see EZ-B v4 doc): https://synthiam.com/Support/Hardware/EZ-B-v4
    • Test with a different USB adapter (known-stable 2.4GHz adapter) to eliminate the adapter as the cause.
  5. Avoid adapter roaming & auto-channel switching

    • In your router & adapter advanced settings, reduce roaming aggressiveness, fix WiFi channel (if using a router), and avoid adaptive/auto channel switching.
    • For AP mode you control the EZ-B AP; but on the PC side, ensure the adapter remains associated to the EZ-B AP and does not try to roam.
  6. Check logs

    • Watch the ARC Console and Windows Event Viewer for crashes. If ARC freezes, look for application error entries around that time.
    • If ARC freezes regularly when the robot connects or when servos move, include those timestamps in logs.
  7. Run ARC as Administrator for testing

    • Run ARC as admin once for testing to rule out permission issues that might cause I/O or log failures. (Don’t make this a permanent fix necessarily.)
  8. Consider a hardware test

    • If possible, test from another laptop or another USB WiFi adapter to isolate the problem.

Reconnect script with timestamped logging Paste this into a new Script skill (Project Add robot skill Script), JavaScript tab. Name the skill "EZB_Reconnect" (or change hb25InitScriptName / monitorScriptName accordingly). This script will:

  • Monitor EZB.isConnected(ezbIndex)
  • When EZB disconnected it calls Connection.Connect0 (or ConnectN for different index)
  • When it reconnects it runs HB25 Init (ScriptStartWait) and starts the D22 monitor (ScriptStart)
  • Appends timestamped lines to a log file

Important: Set logFile to a path your Windows account can write to. If you choose a folder that doesn’t exist, create it first or pick a user-writable location (e.g., C:\Users\Public).

// EZB_Reconnect (JavaScript) - put in a Script skill JavaScript tab
// Monitors EZB index, attempts reconnect and restarts HB25 Init and D22 monitor on reconnect.
// Also writes timestamped events to a log file.

var ezbIndex = 0; // change if your EZ-B is on a different index
var checkIntervalMs = 3000; // how often we check connection when connected
var connectAttemptWaitMs = 4000; // how long to wait after asking Connection to connect
var maxConnectAttempts = 6; // attempts before backing off
var backoffMs = 15000; // backoff when maxConnectAttempts reached

var hb25InitScriptName = "HB25 Init"; // exact script skill name for HB25 init
var monitorScriptName = "HB25_D22_Monitor"; // exact D22 monitor script name

// Path to log file - update to a folder that exists and is writable
var logFile = "C:\\EZB_Reconnect.log"; // Example - create folder or use something like C:\Users\Public\EZB_Reconnect.log

function ts() {
  return (new Date()).toLocaleString();
}

function log(s) {
  var line = ts() + " - " + s;
  print(line);
  try {
    File.appendStringLine(logFile, line);
  } catch (e) {
    // if file append fails, print error so you can pick a different path
    print("Failed to append log: " + e);
  }
}

// Start loop
log("EZB_Reconnect starting, monitoring index " + ezbIndex);

var consecutiveFailures = 0;

while (true) {
  try {
    var connected = EZB.isConnected(ezbIndex);
    if (connected) {
      consecutiveFailures = 0;
      sleep(checkIntervalMs);
      continue;
    }

    log("EZB not connected. Attempting to connect (index " + ezbIndex + ").");

    // Use Connection  ControlCommand Connect0..Connect4 or ConnectAll
    if (ezbIndex === 0) controlCommand("Connection", "Connect0");
    else if (ezbIndex === 1) controlCommand("Connection", "Connect1");
    else if (ezbIndex === 2) controlCommand("Connection", "Connect2");
    else if (ezbIndex === 3) controlCommand("Connection", "Connect3");
    else if (ezbIndex === 4) controlCommand("Connection", "Connect4");
    else controlCommand("Connection", "ConnectAll");

    sleep(connectAttemptWaitMs);

    if (EZB.isConnected(ezbIndex)) {
      log("EZB reconnected. Running HB25 Init and starting monitor.");

      // Start HB25 Init and wait for it to complete
      try {
        controlCommand(hb25InitScriptName, "ScriptStartWait");
      } catch (e) {
        log("HB25 Init start/wait failed: " + e);
      }
      sleep(300);

      // Start the D22 monitor script (async)
      try {
        controlCommand(monitorScriptName, "ScriptStart");
      } catch (e) {
        log("Starting monitor script failed: " + e);
      }

      consecutiveFailures = 0;
      // small delay before continuing loop
      sleep(1500);
      continue;
    } else {
      consecutiveFailures += 1;
      log("Reconnect attempt failed (count=" + consecutiveFailures + ").");
      if (consecutiveFailures >= maxConnectAttempts) {
        log("Max attempts reached. Backing off for " + backoffMs + "ms.");
        sleep(backoffMs);
        consecutiveFailures = 0;
      } else {
        sleep(2000); // quick retry
      }
    }
  } catch (err) {
    log("Exception in reconnect loop: " + err);
    sleep(5000);
  }
}

How to autostart the reconnect script

  • Option A (recommended): In the Connection skill Settings Connection Established Scripts, add a line to start this RECONNECT script, something like:
    • controlCommand("EZB_Reconnect", "ScriptStart") That way the reconnect monitor begins as soon as the connection system is initialized in ARC.
  • Option B: Start it manually in ARC or via a project startup script.

If you already used Connection's Connection Established Scripts for HB25 Init + Monitor, you can instead call HB25 Init and Monitor from the EZB_Reconnect when reconnect happens (the code above already does that).

Next steps I can help with

  • Change the logFile location to a specific folder (e.g., C:\Users\Public\EZB_logs\EZB_Reconnect.log) - if you want, I’ll give file creation instructions and the exact path to set.
  • Add file rotation or maximum size handling to avoid very big logs.
  • Add additional diagnostics to the reconnect script (e.g., log RSSI if available, or log EZB firmware version).
  • Help analyze logs after you run it for a while - paste the log lines and I’ll help interpret patterns and suggest targeted fixes.

Quick questions for you

  1. Do you want the reconnect script to clear $HB25Init on disconnect (so the HB25 Init will re-run at next connect)? The previous monitor script already cleared $HB25Init when it detected EZB disconnect - do you want that retained?
  2. Which path would you like used for the reconnect log? If you're unsure, I recommend:
    • C:\Users\Public\EZB_Reconnect.log
    • or a folder you create (C:\Users\Public\EZB_logs\EZB_Reconnect.log)
  3. Do disconnects correlate with physical movement or servo activity, or are they random even while stationary?

If you want, I’ll:

  • Post a small variant that also logs the Windows Event Viewer system error entries around the time of the crash (requires running ARC as Admin to access everything), or
  • Suggest a recommended USB WiFi adapter model (one with strong 2.4GHz support) if you want a hardware suggestion.

Tell me which log path you prefer and whether you want $HB25Init cleared on disconnect - I’ll give you a personalized copy of the reconnect script with that setting and a one-line Connection setting you can paste into Connection -> Connection Established 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.
#45  

Athena

I ran the EZB reconnect scrpit but got this error:

Error: Missing 4 closing statement (ENDIF/ENDREPEAT/ENDREPEATUNTIL/ENDREPEATWHILE/etc) Done (00:00:00)

This is what my connection skill scriptlooks like: controlCommand("EZB Reconnect Monitor ", "ScriptStart"); controlCommand("HB25 Init", "ScriptStartWait"); sleep(500); // wait a bit, or remove if you don't need a delay controlCommand("HB25_D22_Monitor", "ScriptStart");

Is this correct?

Author Avatar
PRO
Synthiam
#46  

Correct me if I'm wrong, but are you sharing the IO between the ezb and rc servo controller when connected to the motor controller?

Because if so... when you are in RC mode, you're browning out the ezb and slowly damaging the io ports because the ezb io ports are either in a high or low state. There's no resistance on the voltage from the RC servo controller to the ezb IO ports.

And when you're in EZB mode, the RC controller is holding its IO high or low, and it's also straining the EZB IO.

You'd need either a multipoint relay to switch between the two controllers or a PCB of transistor logic.

Author Avatar
PRO
Canada
#47  

Thanks - good info. Two separate issues here, so I’ll cover them clearly and give exact fixes you can paste.

  1. Why you got the "Missing 4 closing statement" error - and how to fix it
  • That error happens when JavaScript code is placed into an EZ-Script editor (or another non-JS editor) and the interpreter expects different syntax/blocks.
  • The reconnect monitor I gave you is a JavaScript script and must be placed in the Script skill JavaScript tab (not the EZ-Script tab). Put the full reconnect code into the JavaScript editor and Start that skill.

Also check your Connection -> Connection Established Scripts lines. They run as EZ-Script (or the small control script area) so:

  • Use exact skill names (no trailing spaces!). I noticed you had a trailing space in "EZB Reconnect Monitor " - that will fail because ControlCommand needs exact control name.
  • Use EZ-Script style lines in Connection Established Scripts. Example you pasted is almost correct but remove the trailing space and you can omit semicolons.

Correct text to paste into Connection -> Settings -> Connection Established Scripts (EZ-Script area):

controlCommand("EZB Reconnect Monitor","ScriptStart")
controlCommand("HB25 Init","ScriptStartWait")
sleep(500)
controlCommand("HB25_D22_Monitor","ScriptStart")

Notes:

  • ScriptStartWait waits for the HB25 Init to finish before continuing. That’s good for ensuring the HB25 receives the neutral pulses before other scripts run.
  • Make sure the Script skill names match exactly: "EZB Reconnect Monitor" vs what you actually named the skill (no trailing spaces, same capitalization).
  1. DJ_Sures' hardware warning - what's happening and what to do Short summary: He’s correct - if both the EZ-B and the RC servo controller are driving the same motor controller inputs at the same time, you can back-feed, stress, or damage ports and cause brownouts. You must NEVER let two outputs actively drive the same signal line simultaneously.

Why this happens:

  • Motor controller signal pins and servo/ESC inputs expect a single PWM source. If your RC receiver or RC PWM-to-digital device drives the same pin as the EZ-B servo output, the two outputs "fight" each other electrically (one may be driven high while the other low) causing current flow that can damage drivers or cause resets (brownouts).

Safe solutions (pick one based on convenience and hardware skill level):

A - Best and simplest: Hardware switching (recommended)

  • Use a small multipole relay board (SPDT or DPDT relays) or analog switch IC (e.g., 74HC4053) to physically switch the signal lines from EZB <-> RC receiver to the HB25 inputs.
  • Use one relay per signal (left/right), controlled by your Connection script (or manually) so only one controller is connected at a time.
  • Benefit: complete isolation, safe, easy to understand.

B - Electronic switch or tri-state buffer

  • Use a tri-state buffer or analog switch IC (74HC125, 74HC4066, 74HC4053) with an enable pin to select which controller is connected.
  • Or use a MOSFET-based level translator that only allows one side to drive. Requires electronics knowledge.

C - Opto-isolation

  • Use optocouplers on the PWM signal lines to isolate controllers from each other. Safer but more complex and adds latency.

D - Physical mechanical switch

  • Simple DPDT toggle switch to select "EZB" or "R/C" mode for both motor signal lines and possibly motor power. Works fine for bench testing and is foolproof.

E - Soft / software-only (not guaranteed safe by itself)

  • Use software to release EZB servo outputs (Servo.release(port) or stop sending PWM) when switching to manual, and to reinitialize HB25 when switching back to Automatic.
  • Important: Software release does NOT guarantee the other controller’s output won’t back-feed into EZB I/O pins. Without hardware isolation you still risk stress. Consider software as a convenience, but use hardware switching for true safety.

Practical protective additions (regardless of A-E)

  • Add series resistors (e.g., 1k) on signal lines to limit current if both sides momentarily drive each other.
  • Ensure common ground is correct when switching - the motor controller and whichever signal source is active must share ground.
  • Do not connect power rails from two different controllers to the motor controller’s logic Vcc at the same time unless the design supports it.

Recommended approach for your setup

  • If you want a quick safe test: add physical DPDT toggle or a small 2-channel relay board to switch the two PWM signal lines between EZB and RC receiver. That removes any backfeed risk immediately.
  • If you prefer automatic switching: use a relay board driven by a digital out from the EZB: when ARC is in Automatic, enable relays to connect EZB to HB25; when manual is requested, the relays switch to the RC receiver. This allows the RC to be permanently connected but not driving the HB25 until relays switch - and prevents both from being connected simultaneously.

Script improvements to reduce risk (software side)

  • When switching to Manual, call Servo.release(d12); Servo.release(d13); and set HB25 neutral and stop Movement. That prevents EZB from actively commanding motors.
  • When switching to Automatic, run HB25 Init (the neutral pulses) and then start sending servo pulses again. Example (JavaScript lines to include inside your monitor handler):
// on switch to  manual (D22 low)
Servo.release(d12);
Servo.release(d13);
Movement.stop();
Servo.setPosition(d12, 104); // optional neutral pulse for safety
Servo.setPosition(d13, 104);

// on switch to Automatic (D22 high)
controlCommand("HB25 Init","ScriptStartWait"); // ensure neutral sent
// now resume automatic driving logic

But, again - those lines alone do not protect hardware if the RC receiver remains connected to the same pins. Use hardware switching for safety.

Next steps I can help with

  • If you want, I can:
    • Produce a small wiring diagram and parts list for a 2-relay (2-channel) relay board solution (cheap & reliable).
    • Show an example using a 74HC4053 analog switch or 74HC125 buffer circuit if you prefer a soldered electronics solution.
    • Provide an updated monitor script that automatically issues Servo.release(d12/d13) when switching to manual and runs HB25 Init when switching to Automatic (I already included release/neutral logic earlier but can make it explicit).

Questions for you so I can tailor the solution:

  1. Do you prefer a manual physical DPDT switch, a relay-based automatic switch, or a soldered analog switch solution?
  2. Are the RC receiver outputs 5V logic? (Most are; confirm). What voltage does your HB25 expect for signal?
  3. Do you want me to paste an exact JavaScript snippet to do Servo.release + HB25 Init on mode changes into your monitor script?

If you want the relay parts list and a wiring diagram I’ll provide a simple step-by-step and exactly where to wire grounds, signal, and control relay coil pins so it’s plug-and-play.


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.
#48  

DJ,

This is the pololu r/c multiplexer switcher device, it is designed for you to control up to 4 servos between either of  two separate R/C receivers ( or two EZB's even). I've used this product before.  

User-inserted image

I am only using two channels, the two HB25 M/C are connected to Out 1 and Out 2. S1 and S2 are connected to my EZB (D12,D13 for Automatic Mode) and M1 and M2 are are connected to channels 1 and 2 on a 2.4 R/C receiver (for manual Mode). Channel 5 on the receiver connects to  the SEL pin, and is "Y"connected to a pololu pwm/digital output pin that goes "High" to D22 of the EZB on this project. on the R/C transmitter, flipping Ch5  switch allows me to disconnect drive motors from the EZB i/o pins and switch over to the R/C receiver to control the motors manually. Its not something I will always use but I want the choice and it will be the only r/c controlled feature on this robot. To power this board, I get that from the R/C receiver via the VS pins and I am not connecting this power to any EZB pins or m/c pins. The m/c is powered separately. So my R/c receiver is not directly connected and EZB  I/O pins. I am aware i could use a relay to switch between the two but I found this alot cleaner solution for me and I wanted a way to tell ARC whats going on.

Athena On the JC code we have been working on, I see a "Servo. release()" in that last relay script you created, Would that be helpful on the other script? just a thought??