Hi, I want to report some strange bugs. Maybe you can fix some of them in the next release.
First: the color sensor seems to work only on port 1 for me.
Second: I’ve got a loop that reads values from a NXT us sensor on port 2, an other NXT us sensor on port 3 and the color sensor. Then after a short time the color sensor led goes off and starts blinking red.
I get only the value 0 from the color sensor after that. The other sensors still work fine.
My code:
class MainClass
{
//Ports
static Motor mLeft;
static Motor mRight;
static UltraSonicSensor sLeft;
static UltraSonicSensor sRight;
static EV3ColorSensor sColor;
static void init ()
{
mLeft = new Motor (MotorPort.OutA);
mRight = new Motor (MotorPort.OutC);
sLeft = new UltraSonicSensor(SensorPort.In2,UltraSonicMode.Centimeter);
sRight = new UltraSonicSensor(SensorPort.In3,UltraSonicMode.Centimeter);
sColor = new EV3ColorSensor(SensorPort.In1);
}
public static void Main (string[] args)
{
init ();
while(true){
if(sLeft.ReadDistance() < 20) LcdConsole.WriteLine(“Left”);
if(sRight.ReadDistance() < 20) LcdConsole.WriteLine(“Right”);
if(sColor.Read() > 0) LcdConsole.WriteLine(“Object detected”); //well this line is not required for the bug to happen
}
}
}
-
This topic was modified 10 years, 5 months ago by Orlando_2k.
Follow