Actually, we did. He tested it with a touch sensor, and got the expected readings, so that proves it isn't the FW.mightor wrote:You still never eliminated the one common thing: the firmware.
- Xander
NXC: can't read Dexter pressure sensor values
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC: can't read Dexter pressure sensor values
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC: can't read Dexter pressure sensor values
No, it just means that the TOUCH sensor works fine.
- 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
You forgot: I tried also the sound sensor, it was also fine with all settings, as I wrote before.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC: can't read Dexter pressure sensor values
He tested it in RAW mode, and it gave the proper readings of ~184 and 1023. That means that he was indeed seeing RAW values, and that the FW wasn't messing around. You're right, it does prove that the touch sensor works fine, but since he replaced it with the pressure sensor, and that DIDN'T behave like it should have, it seems pretty obvious that the sensor itself is the issue.mightor wrote:No, it just means that the TOUCH sensor works fine.
- Xander
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC: can't read Dexter pressure sensor values
You forgot: I tried also the sound sensor, it was also fine with all settings, as I wrote before.
hi,
indeed, that's really odd:
In the test program I'm reading "raw" values in both cases from sound sensors,
S1 configured as: SetSensorType(S1, SENSOR_TYPE_SOUND_DBA); SetSensorMode(S1, SENSOR_MODE_RAW); val1 = SensorValue(S1);
S2 configured as: SetSensor(S2, SENSOR_SOUND); val2 = SensorRaw(S2);
attaching the sound sensor:
S1 shows (quiet) 13 ->->-> (loud) 1023
S2 shows (quiet) 988 ->->-> (loud) 263
taking touch sensors instead:
S1 shows (released) 0 -> -> -> (pressed) 999
S2 shows (released) 1023->->-> (pressed) 186
What the hell did the Lego people think when they established (at least) 2 completely different inverse "raw" measuring results for one and the same single sensor ?!?
Code: Select all
#define printf1( _x, _y, _format1, _value1) { \ string sval1 = FormatNum(_format1, _value1); \ TextOut(_x, _y, sval1); \ } int val1, val2; task main(){ SetSensorType(S1, SENSOR_TYPE_SOUND_DBA); SetSensorMode(S1, SENSOR_MODE_RAW); SetSensor(S2, SENSOR_SOUND); while(true) { val1 = SensorValue(S1); val2 = SensorRaw(S2); printf1(0, LCD_LINE1, "%5d", val1); printf1(0, LCD_LINE2, "%5d", val2); Wait(10); } }
Re: NXC: can't read Dexter pressure sensor values
hi,
got a new pressure sensor (500 psi), now it works.
Xander, I could simplify your formula very much - the trick was to change int val into float val
(no Vout, no other buffer):
pressure = (((val / 1023) ) - 0.04) *556;
got a new pressure sensor (500 psi), now it works.
Xander, I could simplify your formula very much - the trick was to change int val into float val
(no Vout, no other buffer):
pressure = (((val / 1023) ) - 0.04) *556;
Code: Select all
#define printf1( _x, _y, _format1, _value1) { \
string sval1 = FormatNum(_format1, _value1); \
TextOut(_x, _y, sval1); \
}
float val;
float pressure;
task main(){
SetSensorType(S1, SENSOR_TYPE_TOUCH);
SetSensorMode(S1, SENSOR_MODE_RAW);
while(true) {
val = SensorRaw(S1);
pressure = (((val / 1023) ) - 0.04) *556;
printf1(0, LCD_LINE1, "%5.0f", val);
printf1(0, LCD_LINE2, "%5.1f", pressure);
if (pressure<150) OnFwd(OUT_A,100);
else
if (pressure>175) Off(OUT_A);
Wait(10);
}
}
Last edited by HaWe on 23 Mar 2011, 10:00, edited 1 time in total.
Re: NXC: can't read Dexter pressure sensor values
I'll update my drivers to use the same formula. Thanks!
- 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: No registered users and 0 guests