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(); }
public MainPage() { this.InitializeComponent(); try { if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.IoT") { m_deviceClient = DeviceClient.CreateFromConnectionString("HostName=pltkw3IoT.azure-devices.net;DeviceId=pltkw87Demo;SharedAccessKey=ABC", TransportType.Http1); m_telemetrySource = new IoTTelemetrySourceGen(); } else { m_deviceClient = DeviceClient.CreateFromConnectionString("HostName=pltkw3IoT.azure-devices.net;DeviceId=rpi2C;SharedAccessKey=ABC", TransportType.Http1); m_telemetrySource = new IoTTelemetrySourceDevice(); //Inaczej null var gpio = GpioController.GetDefault(); pinLED = gpio.OpenPin(LED_PIN); pinLED.SetDriveMode(GpioPinDriveMode.Output); m_lcd = new TK_LCDlcm1602DriverWRC.LCDI2C(0x27, 2, 16); m_lcd.InitAsync(); } //LED uxToggleLaser.IsOn = true; m_telemetrySource.Init(); m_timer.Tick += M_timer_Tick; startTimer(); ReceiveDataFromAzure(); //Po prostu "task" } catch (Exception ex) { m_tc.TrackException(ex); } }
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(); } }