Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by DJ Sures!

How To Use Wheel Encoder From Blockly

I have a 2 wheeled robot running the EZ-B V4.     The EZ-BV4 is driving a PWM Hbridge.  Each wheel has an encoder counting the wheel pulses using an Arduino Mega 2560.   My question is how can I command my robot to move a specified distance stop, and then turn 90 degrees and move another distance stop etc.

I assume I can feed the distance into the Mega2560 via Blockly, but I'm not finding the Syntax to do this.

i.e  move forward 6 feet
1. Set motor L and R motors to PWM 50%
2.  Load 1000 clicks into Mega 2560 odometer counter,  ( can I do this via UART ? )
3.  Robot moves until one of the 2 counters hits 0, then motors stop

Goto next routine.
rotate platform 90 degrees right
1. Set motor L PWM to 50% and  reverse R to PWM 50%
2. Load 450 clicks into Mega 2560 odometer counter,
3. Robot moves until one of the 2 counters hits 0, then motors stop

Related Hardware EZ-B v4
Related Control Wheel Encoder Counter


Upgrade to ARC Pro

Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!

AI Support Bot
Related Content
Thanks dj this has been resolved