mgodsell1973
United Kingdom
Asked
— Edited
Resolved by Dunning-Kruger!
Hi there,
sorry if this is a duplicated post, my tablet appears not to have posted my original.
i am loving my dev kit and learning stacks, but i apart from some Arduino i have not ventured into programming.
what i am looking at is as follows, i currently have an ultrasonic sensor on a servo "scanning" as Traxx moves forwards, however i have noticed that it sometimes it cause a blind spot. so i was thinking by adding a IR sensor constantly facing forward and some coding i could avoid the blind spot by allowing the EZ-B to "decide" which sensor to listen too, depending upon distance.
thanks
Very simple to do...
thanks @Richard R, i will try that over the weekend.
:D
Or you can use another Ultrasonic Ping Radar control but set the servo to NA - since there isn't one And voila! No scripting needed
Thanks @DJ Sures, i will also try that to see which works best - the great thing is that both way's expand my knowledge and understanding
Hi @Richard R,
i have been playing with the code above and trying to work out the best way to have the ez b read the two sensors.
i understand that after the "if" and "else if" funtions i need to add a command, however i believe that i need to put a function in thats says
repeatUntil(1=2) #repeat forever $ping=GetPing(D0,D1) #Read ping sensor $IR=getADC(adc0) # Read the IR sensor, value increases as distance decreases
If($ping>20, $IR<20) = if the ping is greater than 20 Cms and the $IR sensor is less than 20cms
i want it to read the IR sensor and then use the Movement Panel avoid the object endif
sleep(100) endrepeatUntil
but i can't find the code to put the Movement Panel back in control?
regards and thanks once again
stress
This looks like the perfect topic to stop me constantly checking my outside camera...
So if I have this correct you have one ping sensor and one IR sensor?
If so the code you need will be similar to below (modify to suit your requirements and sensors)...
You nearly had the IF statement correct. Think of IFs logically, you wanted to have two values meet the requirements... so IF the ping is more than 20 AND the IR is less than 20. If you wanted it to be true if ping is more than 20 or ir is less than 20 use the OR expression.
Movement panel controls are;
Look them up in the EZ-Script manual for their parameters.
@Rich... Thanks for cleaning up my code.... You probably should have gotten the credit for this one too...
Anyway.... I kinda' feel bad this break has still got you rattled, though....
It'll be fine as soon as I get the moat installed
Thanks @Rich and @Richard r. My next choice was to add ping_wait funtion to tell traxx to wait until the ping reading was higher than the ir reading, then move away from the object Am I right in thinking that by adding the forward command in, its like telling the system to revert back to scanning when moving forward until the ping sensor/ir sensor detects an object?
My latest Ping Roam uses ping_wait in it's turning action, basically;
Provided somewhere in the script before the whole ping/ir checking process you have a Forward() then ending the checking with a Forward() will make the robot avoid an object then continue on it's way.