If it doesn't work I would have to suspect the wiring rather than anything to do with the firmware code.
John Hansen
NXT Sensor Input Ports
Re: NXT Sensor Input Ports
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: NXT Sensor Input Ports
I would have suspected the wiring of the port splitters, too,
if...
- I hadn't tested 3 different port splitters from 2 different builders, and if
- one of those builders hadn't been Xander himself
if...
- I hadn't tested 3 different port splitters from 2 different builders, and if
- one of those builders hadn't been Xander himself
Re: NXT Sensor Input Ports
In my experience, digital sensors tend to need some "boot-up-time" after setting the correct 9V lowspeed sensor mode. Order around 50ms 200ms, but YMMV of course. Maybe the 8ms wait is just too short?
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
Re: NXT Sensor Input Ports
also analog (light) needs much more time! I set both waits to 200 (if less even more faulty):
better!
with analog touch and US: ok!
touch ok: 1023...180, digital ok, too: 8...255 !
with analog light and US: faulty.
analog between 600..700, but digital (US) always 0.
better!
with analog touch and US: ok!
touch ok: 1023...180, digital ok, too: 8...255 !
with analog light and US: faulty.
analog between 600..700, but digital (US) always 0.
Code: Select all
#define printf1( _x, _y, _format1, _value1) { \
string sval1 = FormatNum(_format1, _value1); \
TextOut(_x, _y, sval1); \
}
task DisplayValues() {
int myvalue;
while (1) {
SetSensorLowspeed(S1);
Wait(200);
myvalue=SensorUS(S1);
printf1(0,48, "Digital=%5d ", myvalue);
SetSensorLight(S1);
Wait(200);
myvalue=SensorRaw(S1);
printf1(0,40, "Analog =%5d ", myvalue);
}
}
//********************************************************************
task main()
{
start DisplayValues;
while (1);
}
-
- Posts: 323
- Joined: 29 Sep 2010, 05:03
Re: NXT Sensor Input Ports
Doc,
The NXT Light sensor uses one of the digital I/O lines to turn the light on and off. The hardware attached to that line will almost certainly screw up any i2c traffic on the same port, so I don't think you can mix that sensor with i2c devices. Similarly the NXT sound sensor uses the digital lines to control the operating mode so I suspect it will also not work...
Andy
The NXT Light sensor uses one of the digital I/O lines to turn the light on and off. The hardware attached to that line will almost certainly screw up any i2c traffic on the same port, so I don't think you can mix that sensor with i2c devices. Similarly the NXT sound sensor uses the digital lines to control the operating mode so I suspect it will also not work...
Andy
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT Sensor Input Ports
Sweet! Thanks! That's something I've been wanting for almost a yearafanofosc wrote:...Today I added a couple of lines of code to the enhanced NBC/NXC firmware so that it does copy over the ADRaw value even when the sensor type is one of these three values.
John Hansen
I know the limitations of using pins 5 and 6 for analog sensors while also attempting to use I2C stuff. For what I did before (when switching between lowspeed and analog), I was just reading a POT on the analog line (didn't need pin 5 like the light sensor does).
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
Who is online
Users browsing this forum: No registered users and 2 guests