private async void Page_Loaded(object sender, RoutedEventArgs e) { //Stopwatch TK_LCDlcm1602DriverWRC.LCDI2C l = new TK_LCDlcm1602DriverWRC.LCDI2C(0x27, 2, 16); await l.InitAsync(); l.backlight(); l.setCursor(0, 0); l.printstr("ABC"); l.blink(); l.noBlink(); l.scrollDisplayLeft(); l.scrollDisplayRight(); l.cursor(); l.printstr("DEF"); l.setCursor(2, 1); l.printstr("GHI"); l.noCursor(); l.createChar(0, bell); l.createChar(1, note); l.createChar(2, clock); l.createChar(3, heart); l.createChar(4, duck); l.createChar(5, check); l.createChar(6, cross); l.createChar(7, retarrow); l.clear(); l.home(); for (byte i = 0; i <= 7; i++) { l.write(i); } l.noBacklight(); return; //await testIfWorking(); }
private async void M_timer_Tick(object sender, object e) { if (processing) { return; } processing = true; try { var data = await m_telemetrySource.GetData(); var messageString = JsonConvert.SerializeObject(data); var message = new Message(Encoding.UTF8.GetBytes(messageString)); await m_deviceClient.SendEventAsync(message); uxValues.Text = data.ToString(); Debug.WriteLine(data.ToString()); m_lcd?.home(); m_lcd?.printstr($"{data.Dt:mm:ss} {data.ARDUINO_LIGHT:D3} {data.PCF8591_CH0:D3}"); } catch (Exception ex) { m_lcd?.home(); m_lcd?.printstr("ERROR"); } finally { processing = false; } }
private async Task runDemo() { TK_LCDlcm1602DriverWRC.LCDI2C l = new TK_LCDlcm1602DriverWRC.LCDI2C(0x27, 2, 16); await l.InitAsync(); while (true) { l.noBacklight(); await Task.Delay(1000); l.setCursor(0, 0); await Task.Delay(1000); l.backlight(); await Task.Delay(1000); l.printstr("OK!"); await Task.Delay(1000); l.blink(); await Task.Delay(1000); l.noBlink(); await Task.Delay(1000); l.scrollDisplayLeft(); await Task.Delay(1000); l.scrollDisplayRight(); await Task.Delay(1000); l.cursor(); await Task.Delay(1000); l.setCursor(2, 1); await Task.Delay(1000); l.printstr("Windows IoT"); l.noCursor(); await Task.Delay(1000); l.createChar(0, bell); l.createChar(1, note); l.createChar(2, clock); l.createChar(3, heart); l.createChar(4, duck); l.createChar(5, check); l.createChar(6, cross); l.createChar(7, retarrow); await Task.Delay(1000); l.clear(); l.home(); for (byte i = 0; i <= 7; i++) { l.write(i); } await Task.Delay(1000); l.clear(); } }