Skip to content

Color Sensor's code not working #882

@ClementG-63

Description

@ClementG-63

Each mode of the ColorSensorMode is not working except the mode "Color".
RGB, Reflexion, Ambient are giving None and value equals 0.

       static void Main(string[] args)
        {
            Brick _brick = new Brick();
            EV3ColorSensor color = new EV3ColorSensor(_brick, SensorPort.Port3);
            color.ColorMode = ColorSensorMode.Ambient;

            int count = 0;
            while (count < 100)
            {
                Console.WriteLine(color.ReadColor());

                var value = color.Read();
                Console.WriteLine(value + "%");

                if (value == 0)
                {
                    color.SelectNextMode();
                    Console.WriteLine("Mode changed" + color.SelectedMode());
                }

                Task.Delay(300).Wait();
            }
        }

Expected behavior

That's testing each mode, if 0 given : swap mode.
Result :
None
0%
Mode changedReflection
None
0%
Mode changedGreen
None
0%
Mode changedBlue
None
0%
Mode changedRed
None
0%
Mode changedColor
Brown
7% (not percentage)

Last Version Used
Add following information:

  • dotnet --info :
    SDK .NET Core (reflétant tous les global.json) :
    Version: 3.0.100
  • dotnet --info on the machine where app is being run (not applicable for self-contained apps)
  • Version of System.Device.Gpio package : Last Version
  • Version of Iot.Device.Bindings package : Last Version

Metadata

Metadata

Assignees

Labels

Priority:3Work that is nice to havebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions