Page 1 of 1

NXC: RGB-Colorsensor disturb Soundsensor

Posted: 11 Feb 2013, 10:33
by bbernh13
hi,

connect the LEGO soundsensor with the NXT port S1 and the (new) LEGO RGB-Color Sensor with port S2.
run this simple program:

Code: Select all

task main()
{

 string msg;

 SetSensorSound(IN_1);
 while(true)
 {
    msg="data:           ";
    msg = StrReplace(msg, 6, NumToStr(SENSOR_1));
    TextOut(0, LCD_LINE1, msg, false);
   
    SetSensorColorBlue(S2);
    SetSensorColorNone(S2);
}

 
}
with connected RGB sensor the sound value shows up to 60. disconnect the RGB-Sensor now, and u see, that the value come down.

Whats happen ?

Greetings

Re: NXC: RGB-Colorsensor disturb Soundsensor

Posted: 11 Feb 2013, 16:52
by afanofosc
Does it make a difference which port the color sensor is connected to, i.e., if it is further away from the port the sound sensor is connected to? Does it make a difference if you add a Wait(MS_500) or something like that in your loop? If you set the color sensor type one time outside the loop and do not call that function inside the loop does it change the behavior? Do you see this trouble with the standard LEGO firmware or the enhanced NBC/NXC firmware or both?

I would be surprised if it is a compiler bug or something like that but it might be a firmware bug or, possibly, a hardware issue where the signal going back and forth between the color sensor and the NXT on S2 is disturbing the AD value coming back on S1.

John Hansen

Re: NXC: RGB-Colorsensor disturb Soundsensor

Posted: 11 Feb 2013, 17:51
by circuitmage
Is this running on batteries?

If so, maybe the batteries are low and affecting readings with different loads?

Just guessing, I have not tried this yet.