![]() |
Using an Analog Ultrasonic Sensor
1 Attachment(s)
Hi, I have been trying to use a maxbotix ultrasonic sensor to get a distance using java. The sensor is on an analog channel so it seems that I cannot use the frc api for the ultrasonic sensor. I have the math worked out, and it prints a distance in inches, however the voltage on the sensor is not changing when I move the sensor, which means it is not sending out signals. How can you start the sensor and make it send out sonar signals? Or if I am not going about this the right way, is there a better way to do this? this is what I have so far:
Attachment 16178 |
Re: Using an Analog Ultrasonic Sensor
We had a similar issue with the Analog sensor. We discovered that our analog breakout board went bad and after we swapped it we could see the voltage values change in response to object detection.
We did a simple test like you did, but we were tossing the output into SmartDashboard. Where does System.out.println(x) go? Is there an easy way to send console output back to the computer for display or log? |
Re: Using an Analog Ultrasonic Sensor
yes, you can see System.out.println() in netbeans in the output window if you keep it open alongside the drive station.
|
Re: Using an Analog Ultrasonic Sensor
I think your code needs a small adjustment. It looks to me like it gets a single range value and keeps printing it over and over in the while loop. Move the range statements inside the while loop. Good luck!
|
| All times are GMT -5. The time now is 09:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi