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

ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

PRO
USA
#2  

Thanks dj this has been resolved