Add using statements to the GrovePi libraries Add the following to the using statements at the top of the file.
This example will demonstrate how to blink and LED on and off.
You will write code that performs the necessary functions for the application, but there will not be any UI.
Unlike a graphical (or headed) UWP application, where the Windows IoT OS is limited to running only one app at a time, Windows 10 IoT Core (and better) can run multiple BackGround Task applications at once. This application will run as a background task on a Windows 10 IoT device.
To install GrovePi for Windows IoT, run the following command from the Package Manager Console.The GrovePi libraries are easy to install using the Package Manager Console. The GrovePi libraries provide an abstraction over the Windows 10 IoT Core GPIO, I2C and SPI interfaces expose the sensor and device functionality as objects.
Launch Visual Studio and start a new Background Application (IoT) (found in the Templates -> C# -> Windows -> Windows IoT Core node).The Universal app you will write, however, will access the General Purpose Input/Output (GPIO) of the device, so the app won’t be compatible with devices that don’t have a GPIO. In theory this could be nearly any device, such as a phone, a tablet or a Raspberry Pi 2.
In this lab, you will create a Universal app targeting IoT devices running Windows 10. In fact, the Universal app that you write may be able to run on multiple device families, depending on the device characteristics that it takes advantage of. The UWP enables you to write an app that targets a device family, such as IoT devices.
You can read more about how the GrovePi Shield works here.Ĭonnect the GrovePi shield to the Raspberry Pi 2.Ī Universal Windows app is a Windows experience that is built upon the Universal Windows Platform (UWP), which was first introduced in Windows 8 as the Windows Runtime. The GrovePi shield includes an Analog-Digital Converter enabling you to connect analog devices to the A0-A2 connectors. Note: The Raspberry Pi 2 doesn’t have analog GPIO.
The GrovePi Shield exposes GPIO pins (labeled D2-D8 for digital and A0-2 for analog), I2C (pronounced Eye-Squared-See) and Serial/SPI connections. The GrovePi Shield simplifies accessing the pins by providing connectors that you can simply plug sensors and devices into. Twenty-six of the 40 pins are GPIO pins the others are power, ground, or reserved pins. The outputs can be LEDs, servos, motors or countless other devices. The inputs can be from switches, sensors or other devices. Through your app, you can designate pins to either receive input or send output. The GPIO pins are a physical interface between the Raspberry Pi 2 and the physical world. GPIO stands for General Purpose Input/Output and refers to the two rows of pins on Raspberry Pi 2. The Raspberry Pi 2 connects to the physical world through the GPIO pins. If you haven’t already done so, follow the setup instructions at ‘Setting Up Your Raspberry Pi 2’.