2016-09-18 184 views
0

我想只使用一個小程序,以確保我有一切正確設置。但是,我收到引用「GPIO」 的所有內容的錯誤(請參閱註釋)。另外,我已經引用了「適用於UWP的Windows IoT擴展」。 - 謝謝你的幫助,非常感謝!Windows物聯網樹莓派GPIO與VB.net

Imports Windows.Devices.Gpio 'Imports statement is unnecessary 

Public NotInheritable Class MainPage 
Inherits Page 
Private gpio 
Private pin As GpioPin 'ERROR: GpioPin is not defined 
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 'ERROR: GpioController is not declared 
     End If 

     'Check if LED's pin was already initialied 
     If pin Is Nothing Then 
      pin = gpio.OpenPin(LED_PIN) 
      pin.Write(GpioPinValue.Low) 'ERROR: Not Declared 
      pin.SetDriveMode(GpioPinDriveMode.Output) 'ERROR: Not Declared 
     End If 

     'Read pin status and invert state 
     If pin.Read = GpioPinValue.High Then 'ERROR: Not Declared 
      pin.Write(GpioPinValue.Low) 'ERROR: Not Declared 
     Else 
      pin.Write(GpioPinValue.High) 'ERROR: Not Declared 
     End If 
    End Sub 
End Class 
+0

看起來你已經有了一個發展的環境問題。你確定你已經安裝了Windows SDK 10586嗎? – Jackie

回答

-1

嘗試

If gpio Is Nothing Then 
    gpio = GpioController.GetDefault.openpin(LED_PIN) 
end if