Posts Tagged Getting Started
Windows 10 IoT Core – Setting Default App
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/05/17
The default startup app supplied with Windows 10 IoT core provides interesting information about your device and basic settings, but does not do anything and does not even provide a launcher for your app.
What we want is for our application to start when we power on the device. This will allow us to specialize the device, and its purpose essentially becomes to run our application and nothing else.
This procedure only deploys debug version applications. Its good for temporary setup AND to demonstrate Setting Default Application. Because the debug certificate is temporary, the application will eventually stop working. I will write a post about deploying release application at some point.
Updating the Manifest
This step is optional, but it makes things easier.
The first step is to identify our application. By default when we create the Universal Windows application, the identity of your application is set as a guid. The identity for our application was:
- 234b35b2-e6d4-471c-8473-5d584ad0ee1a
To make it much easier to find our application in a list, I want to change it to:
- ChristianLavigne-LogicGate
To change the identity you need to change the manifest. Here is how:
- Right Click on your Project (Windows Universal)
- Select ‘Properties’ you will get the following screen. Click on the ‘Package Manifest’ button, you will get the manifest page:
- Select the ‘Packaging’ tab:
- Take note of the Package Name (to uninstall from the device later)
- Replace the Package Name, I used ‘ChristianLavigne-LogicGate’:
Note: The ‘Package family name’ contains the name as displayed on the device - Click the Visual Studio ‘Save’ button to save the manifest.
Deploying the Application
To do this, I will use Visual Studio to deploy a debug version of the application. Building release packages is a bit more complicated and will be the subject of another blog entry.
After updating the manifest, re-build the application (in debug) and start a debugging session by clicking run with remote machine selected. Same as we have done before.
When starting the debug process, Visual Studio will deploy a new version of our application on the device. Once started, you can stop the application from Visual Studio by using the menu Debug | Stop Debugging.
Setting the Device Default App
To update the default app, we start Windows Device Portal web page of our device.
- Navigate to the ‘Apps’ page.
- In the Installed apps drop down lisbeforet, select your app, ChristianLavigne-LogicGate_1.0.0.0_arm_xxx in our case, and click the Set Default.
What this does is interesting. With the Raspberry Pi on, we can see that our app immediately starts. If it shuts down for any reason, our app will re-start. When you reboot your Raspberry Pi, it will start our app again.
In essence it will only run this application, until we set a new default. If we want to go back to the original application supplied with the OS, select IoTCoreDefaultApp and set it as the default.
Removing Old Application
Because we renamed the application in the manifest, we now have a duplicate of the application installed. To remove the old version, we select it in the Installed apps and click the Remove button. I also had another application I created earlier, so I removed it.
Conclusion
Setting the Default App allows you to specialize your device to perform only a single task. You can use you Raspberry Pi to run hardware specific applications, or to run as a media player, or run kiosk software. Any Universal Windows application will work, so capability offers a wide range of possibilities.
First Windows 10 IoT Core Windows Application
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/04/21
So now that I have my device up and running, time to start coding. So I’ll be writing my first application.
Objectives
I could start coding a complicated app using the GPIO or talking with advanced devices using I2C. But I just wanted to see what was possible on the device first.
The objective of this first application are:
- Creating a MINIMAL basic UI based application.
- See if it could be deployed to the device.
- See my application run on the Raspberry Pi.
- Start a debugging session, place break points and watch variable values.
Getting Started
Creating a Universal Windows Project
In Visual Studio 2015, I clicked File | New Project….
Coding
Once the project was loaded, I opened up the main page MainPage.xaml. I created a basic layout, added a TextBlock, a TextBox and a Button. Here is the code:
XAML
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="51"/> <RowDefinition Height="51"/> <RowDefinition Height="51"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <TextBlock x:Name="textBlock" Grid.Row="1" TextWrapping="Wrap" Text="Hello World!" HorizontalAlignment="Center"/> <TextBox x:Name="textBox" Grid.Row="2" TextWrapping="Wrap" Text="" HorizontalAlignment="Center" Margin="5" Width="150"/> <Button x:Name="Greet" Content="Button" Grid.Row="3" HorizontalAlignment="Center" Click="Greet_Click"/> </Grid>
I double clicked on the button to write an event handler. And typed in the following code:
C#
private void Greet_Click(object sender, RoutedEventArgs e) { string greet = "Hello World!"; if(!string.IsNullOrEmpty(textBox.Text)) { greet = string.Format("Hello {0}!", textBox.Text); } textBlock.Text = greet; }
Testing the application
To make sure the application was working as expected I started it from my local machine.
As expected, I got a new window with the following in it:
I typed in my name, clicked the button and got:
Fantastic! The app works! So I closed the window to stop the debug process before I continue.
Starting on the Raspberry Pi
Now that I have a working app, it’s time to try to run it on the device. To do this:
- Change set your debug target to Remote Machine
- Specify the machine address
- Change your build target to ARM
- Click Remote Machine to start the debugging session
Once this is done a number of things will happen:
- The application will be built.
- If this is the first time, Visual Studio will check some of the requirements on the remote device and install missing packages.
- Visual Studio will deploy the application to the remote device
- Visual Studio will start the remote debugger for the application on the device
- Visual Studio start the application.
This is the build output for this process:
Output Window (Build)
1>------ Build started: Project: HelloWorld, Configuration: Debug ARM ------ 1> HelloWorld -> C:\prog\IoT\HelloWorld\HelloWorld\bin\ARM\Debug\HelloWorld.exe 2>------ Deploy started: Project: HelloWorld, Configuration: Debug ARM ------ 2>Creating a new clean layout... 2>Copying files: Total 16 mb to layout... 2>Checking whether required frameworks are installed... 2>Framework: Microsoft.NET.CoreRuntime.1.0/ARM, app package version 1.0.23819.0 is not currently installed. 2>Framework: Microsoft.VCLibs.140.00.Debug/ARM, app package version 14.0.23918.0 is not currently installed. 2>Installing missing frameworks... 2>Registering the application to run from layout... 2>Deployment complete (0:01:52.439). Full package name: "ad63be4b-92ac-472f-8c68-f4537d5b5ce9_1.0.0.0_arm__7j55shkp2zhzg" ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
After that the application will start on the Raspberry Pi.
Debugging
So I first tried the application on the Raspberry Pi. I typed in my name, clicked “Button” and got the expected result.
Now going back to my development machine, I place a break point in the button click event handler.
On the device I type Test in the TextBox and click “Button”.
As expected, on development machine, Visual Studio breaks on the break point. I press F10 to step through and I am debugging.
When I look at the watch I can see all the variables value:
I press F5 to resume and the application continues to run as normal.
To stop the application, you need to stop the debugging session in Visual Studio.
Conclusion
It works! I can create a XML based application and run it on my Raspberry Pi.
One thing I have noticed is that the application on the Raspberry Pi is Modal. You cannot stop the application or get out of it. This will be useful in the future.
Re-imaging the SD Card to default
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/04/21
For some reason, my SD card got corrupted. I had to re-build it.
Process
The process to create new SD card for Windows 10 IoT Core is quite simple. All you need is the Windows IoT Dashboard application and an SD card (at least 8Gb is recommended).
- Start Windows IoT Dashboard application
- Give it a few seconds to populate Device type
- Select your device
- Insert you SD card into your computer
- Select your SD card in the Drive drop down list
- Click the “Download and install”
- The application will then download the image (this will take a few minutes). A progress bar is provided.
- Then a command line application will then write the image on the card (again this will take a few minutes). A progress bar is provided.
- When completed you get the following screen:
- Once your device is booted up, you should see it in the My device.
Conclusion
Re-imaging an SD is an easy strait forward process. It takes only 5-10 minutes and you get a brand new device.
You will loose any changes or information stored on your card. So you will have to re-configure it after.
Getting Started with Raspberry Pi
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/04/21
So I finally got the Raspberry Pi hardware yesterday. I will spare you the unboxing video, I’m sure there are a number of them already.
I plugged in the Raspberry Pi to a keyboard, a mouse, and a screen. Added the Wifi USB dongle and started it up.
This blog explores the different ways we can access the device by default. This is only an introduction, we probably will return to see some of those interfaces in more depth as we need them in the future.
Raspberry Pi on screen Experience
(Sorry, I have not figured out how to take screen shots on the Raspberry Pi yet, and phone picture are horrible. I will add screen shots when/if I figure it out)
First Start Up
After churning for a couple minutes, it prompted me for language and selecting the wireless network. That done, it re-directed me to the main screen.
If you saved the default settings, on subsequent start ups, the boot process sends you directly to the main screen.
Main Screen
On the main screen, the device information application is displayed. The top of the screen look like a task bar with applications running on the left with a system tray to the right.
The applications running are:
- Device info
- Tutorials
The system tray has:
- Time
- Device Settings
- On/Off button
The On/Off button offers:
- Shutdown
- Restart
Device Settings Page
The Device Settings page allows you to set:
- Basic preferences: Only sets language at this point
- Network & Wi-Fi: Select and configure Wi-Fi
Windows 10 IoT Core Dashboard
Going back to my development computer and I fired up the Windows 10 IoT Core Dashboard to see what would show up.
Start up
The startup page gets you on the Set up a new device. Setting up a new device is used to create a new SD card. I already had a pre-configured SD card (from the starting pack) so I went directly to My devices.
Device List
My devices show a list of devices connected on your network. Give it a few minutes to detect your device.
From here you can open up the device Settings or Open in Device Portal. I went for Settings.
Device Settings
The Device Settings page allows you to change your device name and set your administrator password. You should take the time to at least change the password. The default password for the Administrator account is: p@ssw0rd
From here we’ll go to the Windows Device Portal in browser.
Windows Device Portal
The Windows Device Portal is a web page served directly by the device. It provides a lot more functionality than the IoT dashboard or the device interactive UI. The left hand menu allows you to navigate to different sections.
The sections are:
- Home
- Apps
- Processes
- Performance
- Debugging
- ETW
- Perf Tracing
- Devices
- Bluetooth
- Audio
- Networking
- Windows Update
Also a number of functions are available on the right hand header:
Here are the more high level and useful pages for now:
Home
The home page provides information about the device, allows you to change the device name and change the administrator password.
App Manager
The App Manager page provides a lot of functionality. It allows you to manage applications, uninstall application, select default startup application. It also allows you to deploy new applications.
Debug
The debugging page provides a list of the current processes, displays error logs and set error reporting parameters. It also allows you to manually start the Visual Studio Remote Debugger.
Note: The remote debugger is not installed by default on Windows IoT Core 10586. It is only deployed the first time you start a debugging session from Visual Studio. If you attempt to start the Remote Debugger before you start a debugging session, you get the following error message is:
Networking
The networking section allows you to set the networking parameters. It provides a list of available networks and displace the current IP configuration for the different networking interfaces on the device (I snipped the screen shot, it actually showed 3 network adapters).
Updates
The Windows Update page allows you to check for available operating system updates. If updates are available they will be installed on the next restart.
Note: See my next post before clicking this button…
Conclusion
This seems to be most of the out of the box high level user interfaces available to interact with the Windows 10 IoT Core operating system.
Of course there are also more advanced mode of interaction available like command lines, PowerShell and programming APIs. But we will see those in other posts in the future.
Windows IoT Core – First Impressions
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/04/18
Now that my development computer is setup, I wanted to look at some code. So I explored a little around the start up sample projects offered by Adafruit where I purchased the Microsoft IoT Pack for Raspberry Pi 2. I also looked at Microsoft supplied samples and the Raspberry Pi Foundation web site.
My goal here was: To look at code to understand the general anatomy of the process to develop IoT devices using the Raspberry Pi. To see someone using the GPOI in C#.
Dice Application
I found tons of good projects of all kind. I just wanted one that would be simple, but would give me an overall view. The one offered by Adafruit offered all the information I wanted:
This blog post clarified a number of points for me:
Windows Universal Application
Visual Studio offers a large amount project templates. Choosing the right template can mean the difference between success and re-doing everything. Unfortunately for me, having done mostly ASP.NET and MVC (with some WPF) applications for the past 15 years, I was not aware of the Windows Universal application thread.
I had already started coding some useful libraries that I wanted to re-use across multiple project types. I used the Portable Libraries project type for those. Of course, I could just copy/paste the code into a Windows Universal class library but that defeats the purpose of re-use… Some re-design will be required there for sure.
WPF User Interface on the Device
I did not expect this and I did not expect it would be this easy. You can write the User Interface for your application to run directly on the device.
Best of all it’s WPF and I am quite comfortable with it. I see great things happening in this department!
Coding the GPIO
Although the code in this application is very linear and repetitive (for simplicity purpose I am sure), it shows that the code to access and control the GPIO is simple. I did some additional research and figured out that: Yeah! This is actually really simple!
Building Electronic Circuit
Last time I wrote an electronic circuit was in 1992. I do have a lot updating to do. The section “Building out the circuit” in this sample was just what I needed to get me thinking about this again.
Perhaps the most interesting thing here is Fritzing . Fritzing is an application to create and document your electronic circuit prototype. That is definitely something I will have to explore deeper.
Running and Debugging
There is no talk about debugging, but running seems quite easy and strait forward. Just start the application on the device, provide device IP address and Voila!
Conclusion
I feel quite confident we can get this working and have fun doing it. This is going to be a lot easier than I expected!
Setting up Visual Studio 2015 for Windows 10 IoT Core development
Posted by christianlavigne in CodeProject, Windows 10 IoT on 2016/04/16
I found that a good place to get started with the Windows 10 Iot Core is on the Microsoft developer’s site:
https://developer.microsoft.com/en-us/windows/iot/win10/adafruitwelcome
This site provided a good introduction and provides a section on prepping your PC. So I can get started on this right away.
Set up your PC page
https://developer.microsoft.com/en-us/windows/iot/win10/kitsetuppcrpi
The setup was fairly simple for me as I already have Windows 10 and Visual Studio 2015 installed. So I went through the check list quickly:
- Windows 10 (10.0.10240 +) Check
- Install Visual Studio 2015 Check
- VS 2015 Update 1 and + Check
- Validate Visual Studio 2015 (14.0.24720.00) Check/Done
- Install IoT Core Project Templates (Tools > Extensions and Update > Online) Done
- Enable developer mode on Windows 10 device. Done
There are a couple of important things to know:
On step 4 you may need to Add the Visual Studio Tools for Universal Windows Apps if they are not already installed. To add this to Visual Studio do this follow:
- Control Panel -> Programs and Features
- Select your installation of Microsoft Visual Studio 2015
- Right click Change
- Select Modify in the Installer
- Select Features > Windows and Web Development > Universal Windows App Development Tools
- Click Update / Install.
- This may take a while…
For step 5, the step are:
- In Visual Studio click Tools > Extensions and Update > Online
- Type IoT in the search box
- Select Windows IoT Core Project Templates
For step 6, this is about turning off the nagging screen whenever you run a Universal application from Visual Studio. You can read the full instructions. The steps are basically:
- From the Windows Start Menu
- Settings. Choose Update & security
- Choose For developers
- Select Developer mode
- Read the disclaimer and click Yes
Set up your Raspberry Pi 2 page
https://developer.microsoft.com/en-us/windows/iot/win10/kitsetuprpi
If we continue on the setting up the Setting up your Raspberry Pi 2 page. They download an install the IoT Dashboard tool. I decided to download this and install it right now.
Conclusion
We are now ready to go once I receive the Raspberry Pi.
Next we will start looking at code and examples.
Recent Comments