![]() |
VEX Ultrasonic Sensor
I have been trying to use this ultrasonic sensor for our robot but it never works. I am wondering if any one could help me out with the code to run this sensor using Ultrasonic Output in DIO "0" and Ultrasonic Input in DIO "1".
|
Re: VEX Ultrasonic Sensor
You may want to take a look at the WPILib Java documentation on Ultrasonic sensors. I personally haven't used them, but it looks like (based off of the Javadocs) that you code should look similiar to this:
Code:
//Setting up the sensor |
Re: VEX Ultrasonic Sensor
Ok thanks I will try that I was not always having the Enable command.
|
Re: VEX Ultrasonic Sensor
Because you seem to be good at code and we are a 2 year team and have never used java. what would the code be like the track the totes with a HD Microsoft Webcam and make the robot center up with the totes and drive up to them till the ultrasonic sensor says like 6 inches.
|
Re: VEX Ultrasonic Sensor
I can't help you very much with the vision tracking part of the code due to never EVER working with the darn stuff, but I can help with the 6 inch spacing part.
Code:
//After you've found the stack and lined upThis may be all you need, or you may need to expand on this and make it a PI, PD, or PID loop. If you have any issues with this, feel free to ask. I'm happy to help :) |
Re: VEX Ultrasonic Sensor
Here is my current code that is not working for some reason.
Code:
package org.usfirst.frc.team4076.robot; |
Re: VEX Ultrasonic Sensor
Here's your problem:
Code:
public void robotInit() { |
| All times are GMT -5. The time now is 22:28. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi