コード例 #1
0
        static async Task <IScheduledTask> Setup(IMetaWearBoard metawear)
        {
            var temperature = metawear.GetModule <ITemperature>();
            var thermistor  = temperature.FindSensors(SensorType.PresetThermistor)[0];

            await thermistor.AddRouteAsync(source => source.Stream(_ => {
                Console.WriteLine($"{_.FormattedTimestamp} -> {_.Value<float>()}");
            }));

            // Temperature is classified as a forced data producer
            // Schedule periodic `Read` calls in the firmware, do it after route is setup
            return(await metawear.ScheduleAsync(1000, false, () => thermistor.Read()));
        }