
Bravia
Ireland
Asked
— Edited
A little help with Ez Script Please
I am using four ADC inputs to ezb to control two servo motors. see sample Ez Script
only one adc will have a low value at any given time all others will be high. a low on any adc input should give a specific value to the two servo motors.
Using repeat this scans the adc inputs ,but I need to address the second servo also if(adc(adc0) < 100) servod(do, 20) if(adc(adc1) < 100 servo(d0, 30) if(adc(adc2) < 100 servo(d1, 25) if(adc(adc3) <100 servo(d1, 35)
Appreciate any assistance you could give
Pat
Are you trying to move the servo into a position relative to the adc input value?
No Dj Using the adc as a trigger only
Pat
For example, you'd like to use the ADC for push-buttons to move the servos into different positions?
Please let me outline its purpose
I have four IR sensors on my Robot ( IR Beacons)
Front Back Left Right
Normall high output (4.8v) until one detects IR then that sensor goes low, other 3 sensors rermain high.
Sensor outputs are connected to ADC ports on EZb. I require Ez Script to Constantly monitor ADC inputS. Detect which one is low,and then send commands to two servos (d0,d1)
e.g Hold a ir transmitter in front of robot it can move forward, hold ir sensor at back of robot it will turn around , same with left & right
program requirement, must constantly monitor inputs & if low send command to servo d0 & d1 simultaniously
Monitor ADC0 if low, output servo(d0, 20) & servo(d1, 30) monitor ADC1 If low, output servo(d0, 30) & servo(d1, 40) monitor adc2 if low ,output servo(d0, 5) & servo(d1, 15) monitor adc3 if low,output servo(d0, 25) & servo(d1, 35) repeat
Thank You Pat
Ah brilliant!
Try this..
excellent
One last question not sure where to enter the actual mulible servo commands as I am using indivdual servo,s to operate a joystick. Have tried to enter in movement script but no joy. Sorry I know its probably in how to
confused
Under Tutorials, you will find a "Continuous Servos" guide. You may follow that video to see how to use modified servos to control your robot. Then, you can use commands such as "Forward(), Left(), Right(), STop(), etc"
sorry forgot to mention my Robot has an electric wheel chair base .
SAMPLE SCRIPT
forward
if(adc(adc0) < 100) servo(d0, 37) if(adc(adc0) < 100) servo(d1, 34)
reverse
if(adc(adc1) < 100) servo(d0, 30) if(adc(adc1) < 100) servo(d1, 40)
no marks for my programming skills ,but it seems to work as I move two servos with one adc input
Thanks DJ