What is the usecase for the methods: disable and enable on the sensor EV3UltrasonicSensor

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

User avatar
esmetaman
Advanced Member
Posts: 372
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

What is the usecase for the methods: disable and enable on the sensor EV3UltrasonicSensor

Postby esmetaman » Sat Mar 24, 2018 6:43 pm

Hi Andy,

The EV3 Sensor Ultrasonic Sensor has 2 methods: enable & disable:
http://www.lejos.org/ev3/docs/lejos/har ... ensor.html

And I would like to know what is the use case for that methods.

Reviewed other EV3Sensors, I didn´t see that methods:
http://www.lejos.org/ev3/docs/lejos/har ... ensor.html
http://www.lejos.org/ev3/docs/lejos/har ... ensor.html
http://www.lejos.org/ev3/docs/lejos/har ... ensor.html
http://www.lejos.org/ev3/docs/lejos/har ... ensor.html

Many thanks in advance

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 6022
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: What is the usecase for the methods: disable and enable on the sensor EV3UltrasonicSensor

Postby gloomyandy » Sat Mar 24, 2018 8:19 pm

I assume you have read the documentation? It tells you one use case, it lets you turn the LED surrounding the sensor on and off (see this now very old video...)
https://www.youtube.com/watch?v=NhMYSSVzw14
turning the sensors LED on and off in this video is performed using enable/disable. However they also have other uses. You may have multiple ultrasonic sensors on the same robot, trying to use two at the same time will probably end up with interference between them. Using enable/disable allows you to have just one running with the others turned off. As with most of these lower level functions they simply reflect what functionality the hardware has, the Ultrasonic sensor has a disabled mode (mode 3) so we make that available for use. In effect any mode other than 3 is enabled, calling enable simply sets the sensor to the default mode (mode 0).
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 372
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: What is the usecase for the methods: disable and enable on the sensor EV3UltrasonicSensor

Postby esmetaman » Sat Mar 24, 2018 11:39 pm

Many thanks Andy for the clarification,

I will try to implement both methods using the EV3Dev API:
http://docs.ev3dev.org/projects/lego-li ... 3-us-modes

Related issue:
https://github.com/ev3dev-lang-java/ev3 ... issues/436

Cheers

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 1 guest