NXC: RGB-Colorsensor disturb Soundsensor

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
bbernh13
Posts: 1
Joined: 11 Feb 2013, 10:10

NXC: RGB-Colorsensor disturb Soundsensor

Post 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
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC: RGB-Colorsensor disturb Soundsensor

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
circuitmage
Posts: 68
Joined: 14 Dec 2012, 17:56
Location: Austin, TX

Re: NXC: RGB-Colorsensor disturb Soundsensor

Post 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.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest