![]() |
Ultrasonic analog input?
We have ultrasonic analog input, wired based on a youtube video.
I however don't understand the parameters of Ultrasonic namehere=new Ultrasonic(a, b); a is input, what does that mean? b is output, what does that mean? I tried 8, 7 and tried with the ultrasound in both analog 8 and analog 7, with the following code: Code:
if(namehere.getRangeMM<10)Also are their good java tutorials for cameras/encoders/solenoid magnetic sensor thingies anyone know them? (By "good" I mean that it explains the api and the parameters. for example: this parameter means you have to wire the output to <analog/DIO/pwm/other> and it will reference that slot.) |
Re: Ultrasonic analog input?
We have had more luck with an AnalogChannel object instead of Ultrasonic. Then the getAverageVoltage method returns a value between 0-5v which you can use a scale factor to translate into a distance. We found the scale factor on the stats sheet that came with the rangefinder.
|
Re: Ultrasonic analog input?
Thanks, tried that. It didn't work. I tried distance.getAverageVoltage()<=1 and distance.getAverageVoltage()*9.8<=6 but neither of those worked.
Am I doing something wrong? Using the slot 1 because it won't let me use slot 8. AnalogChannel distance=new AnalogChannel(1); |
Re: Ultrasonic analog input?
Could you post the code to see what else there might be? Also, have you tried printing out the value from the distance.getAverageVoltage() method to make sure the hardware is working properly?
something like: Code:
System.out.println(distance.getAverageVoltage()); |
Re: Ultrasonic analog input?
It's always giving a value of 2.99 or 3 (approximately.), I think it is a hardware problem, but will post rest of code tonight if I remember a memory stick.
|
Re: Ultrasonic analog input?
Also having trouble stopping a piston partway through, tried setting both solenoids to true, and both to false.
here is code: Code:
/*----------------------------------------------------------------------------*/ |
Re: Ultrasonic analog input?
With an Ultrasonic sensor, you need to either tell it to ping, or set it to automatic ping mode. Otherwise it will read maximum distance.
Add this to your robotInit(): distance.setAutomaticMode(true); |
Re: Ultrasonic PWM instead of analog input?
Hello all,
1st year mentoring, and boy did I underestimate the time it would take for me to come up to speed on Java. :eek: Anyway, I had the team order a MaxBotix MB7366 http://www.maxbotix.com/Ultrasonic_Sensors/MB7366.htm I speced this one as it has the Free Reading mode which will ignore nearly all other ultrasonic sensors that may be in use on the field. The sensor offers analog voltage, PWM & serial outputs. For better signal/ratio ration I want to use the PWM output, but is there an input in this year's cRIO that will take that PWM input? If not, is there a card that will work with it (preferable a mixed I/O type card so as to not buy 1 card just for 1 PWN input)? Thanks ::ouch:: |
Re: Ultrasonic analog input?
Quote:
EDIT: not exact words, but general meaning. |
Re: Ultrasonic analog input?
Blah. I had it wired in backwards. for anyone in the future: Black wires go towards the main part of the crio.
|
Re: Ultrasonic analog input?
Quote:
Glad you got yours going though! |
| All times are GMT -5. The time now is 22:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi