Exemple #1
0
        static async Task App()
        {
            board = await ConnectionService.Instance.GetFirstDeviceAsync();

            await board.ConnectAsync();

            Console.WriteLine("Board connected: " + board);
            var mux = new I2cAnalogMux(board.I2c, board.Pins[0], board.Pins[1]);

            var temp1 = new Mlx90615(mux.Ports[0]);
            var temp2 = new Mlx90615(mux.Ports[1]);
            var temp3 = new Mlx90615(mux.Ports[2]);
            var temp4 = new Mlx90615(mux.Ports[3]);

            Console.WriteLine("Press any key to close");

            while (!Console.KeyAvailable)
            {
                Console.WriteLine("Temperature Sensor #1: " + temp1.Object);
                Console.WriteLine("Temperature Sensor #2: " + temp2.Object);
                Console.WriteLine("Temperature Sensor #3: " + temp3.Object);
                Console.WriteLine("Temperature Sensor #4: " + temp4.Object);
                await Task.Delay(1000);
            }
        }
Exemple #2
0
        public override async Task Start()
        {
            switch (SelectedSensor)
            {
            case "LM75":
                Sensor = new Lm75(Board.I2c);
                break;

            case "DS18B20":
                Sensor = new Ds18b20(Board.Uart);
                break;

            case "MCP9808":
                Sensor = new Mcp9808(Board.I2c);
                break;

            case "MLX90614":
                var mlx90614 = new Mlx90614(Board.I2c);
                Sensor = mlx90614.Object;
                break;

            case "MLX90615":
                var mlx90615 = new Mlx90615(Board.I2c);
                Sensor = mlx90615.Object;
                break;
            }

            Sensor.AutoUpdateWhenPropertyRead = false;
            OnPropertyChanged(nameof(Sensor));
        }
Exemple #3
0
        static async Task App()
        {
            var board = await ConnectionService.Instance.GetFirstDeviceAsync();

            await board.ConnectAsync();

            var tempSensor = new Mlx90615(board.I2c);

            while (true)
            {
                Console.Write("Ambient temperature: ");
                Console.WriteLine(tempSensor.Ambient.Fahrenheit);

                Console.Write("Object temperature: ");
                Console.WriteLine(tempSensor.Object.Fahrenheit);

                Console.Write("Raw IR data: ");
                Console.WriteLine(tempSensor.RawIrData);

                Console.WriteLine();

                await Task.Delay(1000);
            }
        }