コード例 #1
0
    async Task <HttpResponseMessage> InsertAsync(IoTSensor sensor)
    {
        string insert =
            $"INSERT INTO sensor_values (SensorId, Value) VALUES ('{sensor.SensorId}', {sensor.Value});";

        return(await ExecuteAsync(insert));
    }
コード例 #2
0
        public SensorHubTest()
        {
            var sensor = new IoTSensor(Connectors.GPIO17);

            sensor.PresenceStatusChanged += (active) => {
                count++;
                Console.WriteLine($"PresenceStatusChanged {3}. {0}/{1}", count, max, active);
            };

            while (count < max)
            {
                sensor.Update();
                Thread.Sleep(250);
            }
            sensor.Dispose();
        }