I tried to use my Dexter pressure sensor again but I get no readings
(edit:) always "0" with TYPE_CUSTOM and always 1023 wit TYPE_LIGHT_INACTIVE) - what may be faulty?
(pressure hose tested on both ends)
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
Not sure what to suggest then. You've never bought an NXT set, ever?
- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
no I didn't, because I never liked those pictures for programming (and never tried it since I once tried RCX-code).
I bought the NXTs and some specific sensors at ebay as I already had a lot of Lego Technic and 3 RIS kits at home.
Haven't you got a well-working NXC-program for testing?
BTW: what's the correct sensor end for the pressure input hose? The one closer to the NXT-cable plug or the one at the opposite side? (as I mentioned - just for safety - I tested both without success)
int val;
float pressure;
task main(){
//SetSensorType(S2, SENSOR_TYPE_TOUCH);
SetSensorType(S2, SENSOR_TYPE_LIGHT);
//SetSensorType(S2, SENSOR_TYPE_LIGHT_ACTIVE);
SetSensorMode(S2, SENSOR_MODE_RAW);
while(true) {
val = SensorRaw(S2);
pressure = ((val / 1023) - 0.04) / 0.0018; // Vout = ((val * DPRESS_VREF) / 1023);
printf("raw=%5d", val);
//printf("hPa=%5.1f", pressure); // alrenatively show raw or pressure
Wait(10);
}
}
However, as I suspected, the raw readings from TOUCH and LIGHT are the same, whereas LIGHT_ACTIVE is not. The firmware does some normalisation with this particular sensor. I would suggest you use LIGHT or TOUCH and read the raw values if you want the true ADC values and not something Lego wants you to think is raw. I know you probably won't believe me that the "raw" values for the light sensor (and indeed the sound sensor) are cooked, but I refer you to do the source code. I had this issue when writing a driver for the EOPD sensor.
- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
SetSensorType(S2, SENSOR_TYPE_LIGHT);
makes the same as
SetSensorType(S2, SENSOR_TYPE_LIGHT_ACTIVE);
in both cases constant 0 , so still all the same!
BTW I had _INACTIVE, not _ACTIVE
(Of course I believe that some raw values are cooked if you tell me - but that's weird, they really must not do that with raw values and this should be abolished by the EFW)