Asked — Edited

Sharp IR On Car Robot, Table Top Robot Avoids Falling Off

anyone know how to write this code in java?

:loop adc_wait(adc0,lower,160) stop() reverse(200,500) sleep(50) left(255,500) stop() forward() sleep(50) goto(loop)

now it starts, avoids falling off table, turns left, keeps going - cheers! All figured out below, I solved it below with help of thetechguru

thanks



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skill (view all robot skills)
Infrared indoor positioning for ARC robots: dual-camera tracks IR beacon, shows real-time heading, path and EZ-Script navigation variables

ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

Author Avatar
PRO
USA
#25  

From what I read,

the Sharp IR Analog Distance Sensor (6.99_ detects (avoids) objects in front of  the robot, I have this,  works well,

I going to try The Sharp Proximity Distance Sensor (9.98) to detect more of a depth proximity

I will receive this Sunday and test and let you know,

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#26  

I think the distance sensors don’t work well with close objects, specifically edge detection.

the proximity detector is designed for close contact and edge detection.

Author Avatar
PRO
USA
#27  

proteusy,

received the Sharp proximity sensor, did the test,

much better results, responds very different

Author Avatar
Portugal
#28  

What is the reference of those sensores? Can you post a pic? Thanks

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#29  

The ones I’ve used require a two resistors and they’re tiny and super cheap. Look like this

User-inserted image

but you can get ones that have a pcb with the wiring all ready for you. Maybe like this from Amazon

User-inserted image

Author Avatar
Portugal
#30  

Oh yes, i know those sensors. Thanks.

Author Avatar
PRO
USA
#31   — Edited

proteusy

This is the Sharp proximity sensor, not the distance sensor

works well for me

Here are 2 pics:

User-inserted image

User-inserted image

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#32  

In my experience, the sensor that ezang just posted isn't great for edge detection. They have difficulty with close objects and prefer a distance of 10+ cm away.