private static void datalog() { while (true) { fileLog = new FileLogger("file.log"); // Crea ed utilizza un ADC. Il codice del ADC utilizzerà un gestore del bus SPI adc = new DigitalConverterMCP3208(); lux = new LightSensor(adc, 0, 3.3); temp = new TemperatureSensor(adc, 1, 3.3); moisture = new SoilMoistureSensor(adc, 2, 3.3); co2 = new CO2Sensor(adc, 3, 4.9); rh = new RelativeHumiditySensor(adc, 4, 5.0); shift = new OutShiftRegister(16, 25, 24, 23); lcd = new LCD1602Shift(shift, 12, 11, 10, 9, 13, 14); irrigator = new Device_OnOffShift(shift, 8); ////////irrigator.WriteLog += WriteFileLog; humidifier = new Device_OnOffShift(shift, 2); ////////humidifier.WriteLog += WriteFileLog; lightDevice = new LightDevice(shift, 3, 4, 5, 6, 7, 21, 20); lightDevice.PercentualeApertura(50); //irrigator.TimeOn(3000); //_timer = new DispatcherTimer(); //_timer.Interval = TimeSpan.FromMilliseconds(1000); //_timer.Tick += Timer_Tick; //if (_pin != null) //{ // _timer.Start(); //} } }
public IActionResult Register([FromBody] SoilMoistureSensor soilMoistureSensor) { this._soilMoistureService.RegisterSensor(soilMoistureSensor); return(this.Ok()); }