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??
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.
Thanks a lot! But 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??
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!
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.
The default lane-tracking sensors are just NPN switches (hi/lo impedance). They are not intended to source any voltage.
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.
The KOP optical sensors are part number 42EF-D1MNAK-a2. The paper data sheet and the plastic bag in which they come says they require 11 - 30 VDC. We have then running fine on 12V from the power distribution board. There’s no reason to hook them to 24V. You should save the 24V for the cRIO and the pneumatic solenoids.