Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tour on Pi From Device to First Program

DZone's Guide to

Tour on Pi From Device to First Program

If you've been on the fence about trying Raspberry Pi, take a look at this introduction to it, including setting up a simple program.

· IoT Zone
Free Resource

Address your IoT software testing needs – improve quality, security, safety, and compliance across the development lifecycle.

Welcome to the world of Raspberry Pi. Today, we're going to cover some introductory steps to get you set up with your newest gateway to the Internet of Things. I've been getting messages lately from people wanting a summary of how to get your feet wet with Pi, so we're going to delve into obtaining a Pi, installing the OS, connectivity, and programming. Without further ado, let's get started.

Where Can We Get Raspberry Pi?

The Raspberry Pi device is available at all top branded e-commerce stores, such as Flipkart, Amazon, etc. Sensors are also available at those locations. Read up on the various Pi models before you buy a device.

Install Windows 10 IoT Core OS and Plugin With your Pi

Software needed:

  1. Windows 10 IoT Core Dashboard setup – 500 MB (.iso file) This can be downloaded from GitHub.
  2. Windows 10 Pro on your laptop or PC.

Hardware needed:

  1. 8 GB Micro SD card with Class 4.
  2. SD Card reader.

Step 1:
In your Windows 10 Pro OS machine, download Windows 10 IoT Core dashboard and install it. Run your setup file, then complete the installation.

You will be getting the following:

  • WindowsIoTCoreWatcher
  • WindowsIoTImageHelper

Step 2:
Insert your SD card into your card reader and plug it into your laptop or PC with the USB port. Then now run WindowsIoTImageHelper:

iot


Here, you can find your SD card, which is connected to your device. Select the device and flash it (a format will be undergone in this process).

You will get the following screen, where your Windows 10 IoT core Operating System is written towards your SD card.

screen


screen


Now, unplug your SD card reader, then insert the SD card into the SD card slot available on your Pi. Then, plug in your RP device.

Connectivity:

Step 1:
Start by adding your SD card to the SD card slot in the Raspberry Pi device.


slot


Step 2:
Now plug in your USB mouse and keyboard for you Raspberry Pi.

Step 3:
Plug in the HDMI cable from your Raspberry Pi to your monitor or TV. If you don't have HDMI, then use VGA to HDMI converter.

Step 4:
Connect your Raspberry Pi to the Internet via an Ethernet port or Wi-Fi modem.

Step 5:
Now connect the power source to your Raspberry Pi with the help of either a 5V micro power adapter or a USB data cable connected to your laptop or PC.

Step 6:
Now turn on the monitor. You will get the following screen, during which your Windows 10 IoT Core OS for Raspberry Pi gets loaded:

OS


Step 7:
Select your language. Afterward, you'll see the Device Info screen of Windows 10 IoT Core Raspberry Pi 2.

screen of Windows 10 IoT Core


About Windows 10 IoT Core

The Device Info screen of Windows 10 IoT Core holds the following menu items:

  1. Device Info/Home Screen.
  2. Tutorials.
  3. Settings.
  4. Power.

Device Info/Home Screen

The home screen of Windows 10 IoT Core OS holds the device name, network (which shows the Internet network you've connected to), IP address (of the network), OS Version (OS version of the Raspberry Pi device), followed by Connected Devices (shows the devices connected via USB ports).

Tutorials

The tutorials go over what you can do with your Raspberry Pi, how to plug your device in, a basic LED program, Hello Blinky, etc.

Raspberry Pi device


Settings

The settings tab helps you connect to the network and choose languages.

Power

Power allows you to shut down or restart your device.

First Basic IoT Program

Requirements:

  1. Raspberry Pi 2/3 installed with Windows 10 IoT Core OS.
  2. Laptop or PC with Windows 10 OS (installed with Visual Studio 2015).
  3. Both devices should be connected to the Internet.


Step 1:

Run Visual Studio 2015 on your laptop/computer.

Step 2:
Click on File -> New -> Project -> Select Visual C# -> Windows -> Blank App (Universal Windows). Name your project with the solution name that you need and select the location where you want to save your project file.

New









Step 3:
Right Click on Reference under Solution Explorer and Add Reference, Click on Universal Windows in Reference Manager Window – goto extensions – search for IoT. Add the following references.

  • Windows IoT Extensions SDK.
  • Windows IoT Extensions for the UWP.

Add


Step 4:
 
Under MainPage.xaml, write the code for TextBox and Button:


<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">  
    <TextBox x:Name="Message" Text="How are you?" Margin="10" IsReadOnly="True"/>  
    <Button x:Name="ClickMe" Content="Click Me!"  Margin="10" HorizontalAlignment="Center"/>  
    </StackPanel>  
</Grid>  


You should get the following screen on Designer pane of Visual Studio 2015:

Designer


Step 5:
Now, click on the Solution Name — in this project, the solution name is Hello_World (Universal Windows), right-click on the solution name, and go to properties.

properties


Under Application Page, go to Target Version -> Change it to Windows 10 (10.0; Build 10586) — which is the version of Windows 10 IoT Core OS installed on the Raspberry Pi kit.

Windows 10 IoT Core OS


Note: Now, go to MainPage.xaml. You cannot find the designer pane, as the target version is changed to Windows 10 (10.0; Build 10586)

Step 6:
Go to Solution Platforms in Visual Studio and select the ARM processor

ARM processor


Step 7:
In the next column, change the deployment source to Remote Machine. Here, put the IP address from the Device Info screen of your Raspberry Pi (under IP address), and then click on select.

select


Step 8:
See the output on the monitor or TV connected to your Raspberry Pi. output

Accelerate the delivery of high-quality software in the connected IoT era through an integrated analysis, testing, security, and analytics platform. Parasoft's comprehensive portfolio of testing toolsautomates time-consuming testing tasks and provides management with intelligent analytics and reporting so they can focus on what matters.

Topics:
iot app development ,raspberry pi

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}