Home→Forums→MonoBrick EV3 Firmware→Can the color sensor detect orange?→Reply To: Can the color sensor detect orange?
December 8, 2014 at 17:44
#5048
Auctor137
Participant
Hi everybody,
I’m a litte bit confused.. the new EV3 Colorsensor is not able to read RGB ? Why would LEGO do that?
I’ve tried this Code out of the new Tutorial from Max Mustermann, but with the EV3 Sensor it doesn’t work.
Red 0
Green 0
Blue 0
all the time.
using System;
using System.Threading;
using MonoBrickFirmware.Sensors;
using MonoBrickFirmware.Movement;
using MonoBrickFirmware.Display;
using MonoBrickFirmware.UserInput;
namespace farbsensor
{
class farbsensor
{
static void Main(string[] args)
{
EV3ColorSensor farbsens = new EV3ColorSensor(SensorPort.In1);
bool abfrage = true;
string rotwert, gruenwert, blauwert;
RGBColor RGBFarben = new RGBColor(0, 0, 0);
ButtonEvents buts = new ButtonEvents();
buts.EscapePressed += () =>
{ abfrage = false; };
while (abfrage == true)
{
rotwert = Convert.ToString(RGBFarben.Red);
LcdConsole.WriteLine("Rot :" + rotwert);
gruenwert = Convert.ToString(RGBFarben.Green);
LcdConsole.WriteLine("Gruen :" + gruenwert);
blauwert = Convert.ToString(RGBFarben.Blue);
LcdConsole.WriteLine("Blau :" + blauwert);
Thread.Sleep(2000);
}
LcdConsole.WriteLine("###############");
LcdConsole.WriteLine("PROGRAMMENDE...");
Thread.Sleep(3000);
}
}
}
#EDIT
I forgot
RGBFarben = farbsens.ReadRGBColor();
infront of the “while-loop”, but farbsens does not have the function ReadRGBColor(), how can i do it?
Follow