|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Have problem on getting analog values from lane tracking sensor
Hi everyone. I am new here. Here I met with a problem for sensors. My professor would like to use the analog sensor to receive the brightness of the black and white which means I should get values with a range from 0 to 700 whatever. But I couldn't find the method to access it. Anyone could help??
THXX!!!!!! ************************************************** ************************* We are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns?? Last edited by xinchi.he : 02-10-2011 at 04:49 PM. Reason: Add information |
|
#2
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
the line tracking sensors as found in the kop are not analog, they are simply digital inputs that return true or false. You can customize the threshold on them, but you can't get more detail unfortunately.
|
|
#3
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
Quote:
Thanks!!!! |
|
#4
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
If you have an analog sensor, just plug it into the one of the analog ports on the analog breakout. If your sensor provides an analog value, you could just use GetAnalogIn() (you can find more in the WPI lib reference or the java docs).
Aside from that, you should really be using the provided line sensors. It looks like there will not be a strong contrast in colors between the line and the carpet. However, the line is reflective and the included line sensors work perfectly even from 6 to 12 inches high! |
|
#5
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
1. Import AnalogChannel
2. Use this is to initialize the sensor: Code:
AnalogChannel color = new AnalogChannel(channel number); Code:
System.out.println(color.getValue()); |
|
#6
|
|||
|
|||
|
Re: Have problem on getting analog values from lane tracking sensor
Quote:
Note that the Analog input channels are -10 v to +10 v voltages outside that range will be over-range and may not read correctly. The default IR sensors put out 1 v low and 12 volt high so they are not true digital signals. If you run 12 v into the GPIO lines it will look digital but it is over the max input value and could cause the line to fail. You should check the voltage and make a divider to drop the signal levels down to the 5 v level required. |
|
#7
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
Quote:
Hook it up as follows: brown wire to +24volts (solenoid breakout) blue wire to ground White wire to a DIO input The internal pullup on the DIO provides the voltage. The switch just shorts out the voltage (provided by the pullup) to provide the digital hi/lo signal. Last edited by Ether : 02-12-2011 at 11:57 AM. |
|
#8
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
Quote:
|
|
#9
|
||||
|
||||
|
Re: Have problem on getting analog values from lane tracking sensor
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|