
Bravia
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
Using the adc as a trigger only
Pat
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
Try this..
Code:
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*
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
Man, i really better step it up a notch... you are all showing me up! or down, which ever way it works hahaha
Exhibited a number of times at national "Young Scientist Exhibition" fantastic response.
one of its features is it is touch sensitive . eg tickle its neck and you get a hilarious laugh ,kids loved this
With 16 servos controlling its movements its some fun to programme.
Now with EZB,I wonder will it always be a work in progress.Maybe if you ( DJ ) took a holiday ,and decided no more new features for Ezb that may help me !!!.
As mentioned previously seriously thinking of adding Brain control ,through the EZB of course .
Let the cloning from human to Robot begin.
Pat