Asked
— Edited
Hi @Athena,
I am seeking assistance for a project where I need to establish UART communication between an EZ-Robot EZ-B v4 controller and an Arduino Mega 2560. My objective is to send and receive integer values in the range of 0 to 180 between these two devices.
On the EZ-B v4 side, I will be utilizing JavaScript within the Synthiam ARC environment. Meanwhile, the Arduino Mega 2560 will be programmed using C++.
Could you please provide a sample code or guidance on how to effectively set up this communication?
Thank you for your help, Jack
Related Hardware (view all EZB hardware)
Roli Rover
by EZ-Robot
Roli WiFi planetary rover kit, customizable with 13 ez-bit ports for add-ons, built to traverse varied surfaces. Sold by EZ-Robot
Wi-Fi / USB
Servos
24
Camera
Audio
UART
3
I2C
ADC
8
Digital
24
Related Robot Skills (view all robot skills)
Serial Terminal
by Synthiam
PC and EZB serial terminals for ARC: connect, monitor and send text/ASCII to serial devices. Supports COM, flow control, baud, DTR/RTS, hex
Script
by Synthiam
Multi-language ARC Script: build, run and debug Blockly, JavaScript, EZ-Script or Python with Intellisense, run/save/load and Roboscratch support

Good - this is straightforward to do. Below I’ll give:
If you prefer one format over the other (binary vs ASCII), tell me which and which EZ-B UART index (0,1,2) you want to use and I’ll adapt the code.
Important wiring & safety
ARC (JavaScript) - recommended approach
Example A - Binary single-byte (compact, fastest)
ARC JavaScript (binary)
Arduino Mega C++ (binary)
Example B - ASCII decimal with newline (easier to test with terminals)
ARC JavaScript (ASCII / newline)
Arduino Mega C++ (ASCII / newline)
Testing steps
Configure robot skills via the kebab menu (quick)
Relevant links
Follow-ups / questions
Tell me the UART index and format you prefer and I’ll give you a tailored script + wiring diagram for your exact 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.
Ok let me show you a code snippet and please help me rewrite it to meet my requirements.
My requirements: If header "D" is available, read it as an inbound number 0-180. I do not need to parse it from 4 bytes. Can you rewrite header D to only receive 1 byte? No need to change header "T", it will remain the same as it is coming from the Arduino in 4 bytes. Thanks, Jack
Thanks - this is a small, safe change. Below I:
ARC JavaScript (paste into a Script robot skill)
Notes on the ARC code
Arduino examples (Mega)
Important wiring / timing reminders
Follow-ups I can help with
Useful docs & links
If you paste the Arduino send routine you're using I can confirm it matches this parsing (little-endian vs big-endian) and adjust accordingly.
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.
Thank you, Athena. Lots to ponder here. These are all great examples that teach me a lot. I've discovered a hardware problem with my robot that I must solve first. I think I'm wearing it out.
Jack
Sorry to hear you found a hardware issue - that’s a common place to stop and repair before continuing with communications. Below are practical, prioritized inspection and test steps (mechanical + electrical) you can run with ARC and a few small JavaScript test scripts you can paste into a Script robot skill. When you’re ready, tell me the symptoms (noisy, slipping, overheating, intermittent, reduced torque, drifting, encoder errors, etc.) and I’ll help you focus the tests or craft automated logging.
Quick safety checklist (do this first)
Visual + mechanical inspection (fast wins)
Basic electrical checks
Use ARC to isolate components
Small JavaScript test scripts to paste into a Script robot skill
Note: If you don’t already have a dedicated ADC measure for battery, consider a resistor voltage divider to bring battery voltage into ADC range and use ADC.get() to monitor under load.
What to look for in these tests
When to replace vs repair
Useful links
Next steps I can help with
If you have photos, paste the exact text labels/markings (I can’t view images) - e.g., motor label, part numbers, or error codes. Want me to prepare an automated diagnoser script that logs battery, ADC, CPU temp, and servo positions every second so you can run it while you stress the drivetrain?
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.