Ireland
Asked — Edited
Resolved Resolved by Dunning-Kruger!

Adc Motor Control Script

Attempting to control a motor with potentiometer (adc) and get it to move in correct direction (using hbridge) to a specified ADC position

ideally I want the motor to operate like a servo ,give it a value and it will find that position and stop, this adcspecified would vary.

script if ($adcSpecified = 135) (Get error "variable not defined on this line ")

endif

:start

$adcCurrent = GetADC(adc7)

if ($adcCurrent $adcSpecified) goto( Right) endif if ($adcCurrent = $adcSpecified) goto( Stop) endif goto(Start)

: Left Set(d23, on) Set(d22, off) Return() : Right Set(d23, off) Set(d22, on) Return() : Stop Set(d22, off) Set(d23, off) Halt()


ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

Ireland
#9  

Very rewarding evening of scripting with the support of this communities resident experts I can now instruct a dc motor ( using a hbridge ) to move to any desired position by even voice commands. Will publish more details to assist others in the near future. Many thanks to all who assisted Pat

:):P;):P

#10  

Bravia, I for one am very interested in how this was done. Im currently using wheelchair motors for shoulders, and timed commands are just not accurate enough. PLease keep me in the loop on this. Thanks

                            Chris
#11  

Sorry I missed this thread till now. I overcame this issue a couple years ago. At the time I was using a V3 ezb and was having problems with over shooting my specified variable. I had to use a little math in my scripts to get the motor to center properly without rocking. The V4 may not suffer from this adc lag but if you find this a problem then read over my old and ancient thread. I may be worth reading anyway as it has some scripting you don't see everyday in usual ez scripts. DC Motors, pots & ADC ports

Ireland
#12  

Dave That is one issue I was working on will incorporate your script and see how it works Thank You