private void ReMeasure(object sender, object e) { var t = Sens.Temperature; txt.Text = $"{t}C"; if (t < 21) { LED.SetInt(0); } else if (t < 25) { LED.SetInt(1); } else if (t < 28) { LED.SetInt(2); } else if (t < 31) { LED.SetInt(4); } else { LED.SetInt(7); } }
private async Task Receive() { await Task.Delay(1000); while (true) { var msg = await iothub.ReceiveAsync(); if (msg != null) { var s = Encoding.ASCII.GetString(msg.GetBytes()); LED.SetInt(int.Parse(s)); await iothub.CompleteAsync(msg); } } }