Page 56 - MSDN Magazine, May 2017
P. 56

a new device” in the dashboard to download and install Windows 10 on the SD card. You must have some way to write to this card on your computer. If you don’t have a card reader available, you can buy a USB card reader.
Once you install it and run the
Windows IoT Remote Control app, you can control and interact with the device remotely.
Select the type of device, the OS and the drive where the SD card is located. Give a name for the computer and select an adminis- trator password. Click on the box to accept the license terms and click on the Install button. After downloading and recording the data on the card, you have Windows 10 installed and ready to use. Remove it from the computer card reader and put it in the slot of the Raspberry Pi. Connect it to the network using an Ethernet cable or Wi-Fi if you’re using the Raspberry Pi 3 or 2 with a Wi-Fi dongle. Turn on the device.
Once Windows 10 has booted, you can see the device con- nected under My Devices in the
IoT Core Dashboard.
Developing for the Raspberry Pi Using Visual Studio
To develop for the Raspberry Pi using Visual Studio, you must make sure that you installed the tools. You can check this by selecting “Custom installation” and checking the Universal Windows App Development Tools in the Features selection.
Once you do that, you’ll have the tools installed and you can start developing for the Raspberry Pi using Windows 10. Create a new project and select the “Blank” UWP app.
This will create a blank app and you’ll create an app that shows the name of the current machine in the main screen. In MainPage.xaml, add the following code:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <TextBlock FontSize="32" x:Name="MachineText"
HorizontalAlignment="Center"
VerticalAlignment="Center"/> </Grid>
Then, in MainPage.xaml.cs, put this code to get and display the machine name:
public MainPage()
this.InitializeComponent(); Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation eas =
new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation(); MachineText.Text = eas.FriendlyName;
}
If you run this app on your local machine, it will show a window with the name of your machine.
You can open the device por- tal in the browser using the IP Address shown for the connected device, on port 8080. In my case, I can open it with the address http://192.168.1.199:8080. It will ask you the admin password you’ve set before to open the portal, as shown in Figure 3.
Here, you can configure the device, check the installed apps, and verify its performance and storage. The last option, Remote, lets you enable remote control for the device. This option is useful if the device doesn’t have a monitor attached to it, as you can control it remotely from your computer. Check the box labeled “Enable Win- dows IoT Remote Server” to enable the remote control on the device and download the remote control app for Windows 10 from the store.
Once you install it and run the Windows IoT Remote Control app, you can control and interact with the device remotely.
Now, you can start developing for the Raspberry Pi using Windows 10.
Figure 3 Device Portal
50 msdn magazine
Internet of Things


































































































   54   55   56   57   58