Has anyone used vb.net to control the gpio pins? I have the following code from the forum which looks correct but the error displayed is "gpio controller is not declared". I have recoded the sample below into c++ and it works fine. Any ideas appreciated.
Code: Select all
Imports Windows.Devices.Gpio Public NotInheritable Class MainPage Inherits Page Private gpio Private pin As GpioPin Private Const LED_PIN = 18 Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click Call TurnLedOnOff() End Sub Private Sub TurnLedOnOff() 'Check if gpio was already initialied If gpio Is Nothing Then gpio = GpioController.GetDefault End If 'Check if LED's pin was already initialied If pin Is Nothing Then pin = gpio.OpenPin(LED_PIN) pin.Write(GpioPinValue.Low) pin.SetDriveMode(GpioPinDriveMode.Output) End If 'Read pin status and invert state If pin.Read = GpioPinValue.High Then pin.Write(GpioPinValue.Low) Else pin.Write(GpioPinValue.High) End If End Sub End Class