Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello TCS3472x!");
            var       i2cSettings = new I2cConnectionSettings(1, Tcs3472x.DefaultI2cAddress);
            I2cDevice i2cDevice   = I2cDevice.Create(i2cSettings);

            using (Tcs3472x tcs3472X = new Tcs3472x(i2cDevice))
            {
                while (!Console.KeyAvailable)
                {
                    Console.WriteLine($"ID: {tcs3472X.ChipId} Gain: {tcs3472X.Gain} Time to wait: {tcs3472X.IsClearInterrupt}");
                    var col = tcs3472X.GetColor();
                    Console.WriteLine($"R: {col.R} G: {col.G} B: {col.B} A: {col.A} Color: {col.Name}");
                    Console.WriteLine($"Valid data: {tcs3472X.IsValidData} Clear Interrupt: {tcs3472X.IsClearInterrupt}");
                    Thread.Sleep(1000);
                }
            }
        }