/// <summary> /// Get the current temperature and update the Temperature property. /// </summary> public void Update() { var reading = (float)(AnalogPort.Read() * 3300); reading -= _yIntercept; reading /= _millivoltsPerDegreeCentigrade; Temperature = reading; }
/// <summary> /// Returns the soil moisture current value. /// </summary> /// <returns>Value ranges from 0 - 100</returns> public async Task <float> Read() { DigitalPort.State = true; Thread.Sleep(5); var sample = AnalogPort.Read(); DigitalPort.State = false; Moisture = 100 - Map(sample, 0, 1023, 0, 100); return(Moisture); }
/// <summary> /// Returns the soil moisture current value. /// </summary> /// <returns>Value ranges from 0 - 100</returns> public async Task <float> Read() { Moisture = AnalogPort.Read(); return(100 - Map(Moisture, 0, 1023, 0, 100)); }