NXC: can't read Dexter pressure sensor values
Re: NXC: can't read Dexter pressure sensor values
Then just stick to TOUCH. I doubt John will change this behaviour as it would make sensor readings in the EFW incompatible with the standard one. It would be better to create a new sensor type that doesn't cook the results.
- Xander
- 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)
| 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)
Re: NXC: can't read Dexter pressure sensor values
TOUCH is not good:
1st, it's other way round as LIGHT_INACTIVE
2nd, more important: it produces only raw values between 40 and 18 (in the range of 0-1023).
I actually doubt that these are the correct values, chiefly because _LIGHT or _LIGHT_INACTIVE give constant 0 or 1023 (while the sound sensor in both cases gives correct values)
Have you got the same 40 to 18 range with your own driver?
1st, it's other way round as LIGHT_INACTIVE
2nd, more important: it produces only raw values between 40 and 18 (in the range of 0-1023).
I actually doubt that these are the correct values, chiefly because _LIGHT or _LIGHT_INACTIVE give constant 0 or 1023 (while the sound sensor in both cases gives correct values)
Have you got the same 40 to 18 range with your own driver?
Re: NXC: can't read Dexter pressure sensor values
You should be using SensorRaw if you want the proper values. I was getting values in the 400 range at normal pressure in NXC.
- Xander
- 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)
| 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)
Re: NXC: can't read Dexter pressure sensor values
what is SENSOR_RAW? a sensor type?
as a mode I'm alread using
SetSensorMode(S2, SENSOR_MODE_RAW);
I tried now
SensorRaw(1);
instead of
SetSensorMode(S2, SENSOR_MODE_RAW);
but I'm getting only constantly 0.
But also attaching a sounssensor instead I only get constantly 0 with this.
(@John: rather weird those sensor readings , types and modes in NXC. Please make it better and more logical!)
as a mode I'm alread using
SetSensorMode(S2, SENSOR_MODE_RAW);
I tried now
SensorRaw(1);
instead of
SetSensorMode(S2, SENSOR_MODE_RAW);
but I'm getting only constantly 0.
But also attaching a sounssensor instead I only get constantly 0 with this.
(@John: rather weird those sensor readings , types and modes in NXC. Please make it better and more logical!)
Re: NXC: can't read Dexter pressure sensor values
ps now I think I got it:
SetSensorType(1, SENSOR_TYPE_TOUCH);
SetSensorMode(1, SENSOR_MODE_RAW);
value=SensorRaw(1);
But in this case I only get values from 40...18
([Goodness], what a mess those NXC sensor readings! If once configured as SENSOR_MODE_RAW: why then not read as SensorValue but SensorRaw??? )
SetSensorType(1, SENSOR_TYPE_TOUCH);
SetSensorMode(1, SENSOR_MODE_RAW);
value=SensorRaw(1);
But in this case I only get values from 40...18
([Goodness], what a mess those NXC sensor readings! If once configured as SENSOR_MODE_RAW: why then not read as SensorValue but SensorRaw??? )
Last edited by HaWe on 26 Feb 2011, 21:36, edited 1 time in total.
Re: NXC: can't read Dexter pressure sensor values
The firmware design is LEGO's, not John's So blame them for the messed up sensor modes.
Did you try the program I pasted? It works for me with my DI pressure sensor. I have the 35PSI version.
- Xander
Did you try the program I pasted? It works for me with my DI pressure sensor. I have the 35PSI version.
- 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)
| 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)
Re: NXC: can't read Dexter pressure sensor values
OK: sorry: what a mess with those Lego sensor readings!
Let NXC become better!
(I got the 70 psi version)
What posted code?
Let NXC become better!
(I got the 70 psi version)
What posted code?
Re: NXC: can't read Dexter pressure sensor values
do you mean this:
with this I get constantly 233-234
Code: Select all
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);
}
}
Re: NXC: can't read Dexter pressure sensor values
And with the sensor configured as a TOUCH sensor?
- Xander
- 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)
| 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)
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests