|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Maxbotics Ultrasonic Sensor Not Working
![]() We are trying to use the Maxbotics Ultrasonic sensor as an analog input. However, we are not getting responsive voltages from the sensor. Code:
package org.usfirst.frc.team498.robot;
import edu.wpi.first.wpilibj.AnalogInput;
public class AnalogUltrasonicSensor2017 {
AnalogInput AI;
public AnalogUltrasonicSensor2017(Ports ports) {
AI = new AnalogInput(ports.ULTRASONIC_SENSOR); // !!!MUY IMPORTANTE!!!
}
public double GetRangeMM() {
double output = 0;
output = AI.getVoltage();
output = output / 1000; //Measured in millivolts
output = output / 0.977;
return output;
}
public double GetRangeInches() {
double output = GetRangeMM();
output = output * 25.4;
return output;
}
public double GetVoltage() {
return AI.getVoltage();
}
}
|
|
#2
|
||||||
|
||||||
|
Re: Maxbotics Ultrasonic Sensor Not Working
Double check your conversion factors.
|
|
#3
|
|||
|
|||
|
Re: Maxbotics Ultrasonic Sensor Not Working
We are getting unresponsive voltages. AnalogInput.getVoltage() just returns a value that hovers between 0.2 and 0.3.
The conversion factors may be off, but that isn't the problem we're trying to fix. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|