Wintel物联网平台-Windows IoT新手入门指南
近期,微軟跟進物聯網的速度也在不斷加速,除了微軟手環,。NET MicroFramework,還有一個叫做Windows IoT的項目。該項目早在今年4月份的Build大會上就提出來了,7月份收集初期的開發者和用戶。目前雖然還是處于Developer Program的狀態,但是已經在軟件和硬件上拿得出手了。關于Windows IoT的資源,主要可以參考下面幾個鏈接:
1. Windows Developer Program for IoT 主頁:http://dev.windows.com/en-us/featured/Windows-Developer-Program-for-IoT
2. GitHub主頁:http://ms-iot.github.io/content/WhatsNew.htm
3. Building Apps for Windows主頁:http://blogs.windows.com/buildingapps/
目前,Windows IoT運行在英特爾Galileo 平臺上。該平臺已經發布了第一代和第二代開發板。第二代開發主板是基于英特爾Quark SoC X1000 應用處理器的微控制器板,它也是一個 32 位英特爾奔騰品牌的片上系統 (SoC)。它是第一款基于英特爾架構且設計為與用于 Arduino Uno R3的防護實現硬件和軟件引腳兼容的板。此平臺支持 Microsoft Windows、Mac OS 和 Linux 主機操作系統,因此讓英特爾架構開發簡單易行。它還簡化了 Arduino 集成開發環境 (IDE) 軟件。
關于Galileo平臺,可以參考一下資源:
1. Galileo 第二代開發板主頁:
http://www.intel.cn/content/www/cn/zh/embedded/products/galileo/galileo-overview.html?_ga=1.201686033.105208985.1416798644
2. Galileo開發板主頁:http://www.intel.cn/content/www/cn/zh/education/higher-education/galileo-development-board.html
?
2. 開發環境搭建
2.1 設置PC環境(參考鏈接為Link)
2.1.1
使用LiveID登陸Windows Developer Program for IoT,鏈接地址為Microsoft Connect.
2.1.2
然后下載Visual Studio插件:WindowsDeveloperProgramforIOT.msi,該插件位于Microsoft Connect上,必須登陸以后才能下載。然后安裝。
安裝結束以后,增加了一個Galileo Watcher軟件,如下圖:
2.1.3
啟用Telnet客戶端:具體位于控制面板->程序->啟用或關閉Windows功能,選中Telnet客戶端,如下圖。
? 然后重啟PC。
2.2 設置Intel Galileo
2.2.1 創建一個包含Windows IoT系統的MicroSD卡
硬件上,需要一個容量為16G或者更大的MicroSD卡,同時需要有USB接口的讀卡器,方便和PC連接。
在Connect上下載apply-BootMedia.cmd文件,以及對應Galileo板子對應的系統鏡像,要注意的是,一代伽利略和二代伽利略的鏡像是不一樣的,按需下載:
- Microsoft Windows Intel Galileo Gen 1
- Microsoft Windows Intel Galileo Gen 2
然后就是把操作系統鏡像寫入SD了。首先,把microSD卡格式化為FAT32格式,使用管理管方式打開命令行,
在命令行中進入apply-BootMedia.cmd文件所在的路徑,然后輸入命令:
cd /d %USERPROFILE%\Downloads apply-bootmedia.cmd -destination {YourSDCardDrive} -image {.wimFile downloaded above} -hostname mygalileo -password admin
以我的為例,具體命令如下:
F:\Software\Develop\WindowsIoT>apply-bootmedia.cmd -destination I: -image 9600.16384.x86fre.winblue_rtm_iotbuild.140925-1000_galileo_v2.wim -hostname mygalileo-password admin
如果是在Windows 7下操作,還需要做如下鏈接的操作:Link
然后就開始寫操作系統鏡像,整個過程大約需要15分鐘左右,需要耐心等待。命令行截屏信息如下:
?
?
?
?
注意,一定要等到“正在應用映像”結束以后才算是成功。
2.2.2 啟動Galileo的Windows
首先,將SD卡插入到板子上,然后,給板子上電,同時,將PC的網口和板子的網口通過網線連接。如下圖所示。
上電以后,板子的電源指示燈亮起。SD卡對應的LED燈閃爍。啟動系統大概需要2分鐘的時間。啟動完畢以后,SD卡對應的LED燈就熄滅了。
然后,可以看到Galileo Watcher軟件上出現板子的信息:
2.2.3 與Galileo進行TelNet通信
我們需要使用Telnet客戶端與Galileo進行通信,從而判斷其連接是否正常,同時,需要通過Telnet客戶端來關閉Galileo。
在“運行”中,輸入“telnet mygalileo”,如下圖所示。
在彈出的驗證窗口中輸入如下用戶名和密碼信息:
Username: Administrator
Password: admin
?
?
?
當出現如上所示的信息以后,才表示PC與Galileo正確連接,下面就可以使用Visual Studio進行調試了,如果沒有做這一步,那么是無法進行Visual Studio調試的。
2.2.4 關閉Galileo
在上述的telnet mygalileo命令行中,輸入以下指令:shutdown /s /t 0。
當Galileo關閉以后,其microSD卡的指示燈會停止閃爍。注意,每次關閉電源之前最好使用指令關閉Galileo。因為不然的話,下一次啟動時間會比較長,需要經過Check Disk的過程,和PC上一樣。
?
3. Hello Blinky工程
打開Visual Studio,新建項目,選擇File -> New Project and Select Templates -> Visual C++ -> Windows for IoT -> Galileo Wiring app。如下圖所示。
其Main.cpp文件代碼如下:
// Main.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "arduino.h"
int _tmain(int argc, _TCHAR* argv[])
{
??? return RunArduinoSketch();
}
int led = 13; // This is the pin the LED is attached to.
void setup()
{
??? // TODO: Add your code here
??? pinMode(led, OUTPUT); // Configure the pin for OUTPUT so you can turn on the LED.
}
// the loop routine runs over and over again forever:
void loop()
{
??? // TODO: Add your code here
??? digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
??? Log(L"LED OFF\n");
??? delay(1000); // wait for a second
??? digitalWrite(led, HIGH); // turn the LED on by making the voltage HIGH
??? Log(L"LED ON\n");
??? delay(1000); // wait for a second
}
其代碼結構如下:
4. 測試硬件準備
需要一個面包板,一個電阻,一個LED燈,兩根導線,連接方式如下圖所示:
?
?
5. 調試結果
編譯以后,點擊部署,在彈出的對話框中,輸入
Username: mygalileo\Administrator
Password: admin
如下圖所示:
部署成功以后,可以看到LED燈閃爍。如下圖所示。
?
參考鏈接:
1. Windows Developer Program for IoT 主頁:http://dev.windows.com/en-us/featured/Windows-Developer-Program-for-IoT
2. GitHub主頁:http://ms-iot.github.io/content/WhatsNew.htm
3. Building Apps for Windows主頁:http://blogs.windows.com/buildingapps/
4. Galileo 第二代開發板主頁:
http://www.intel.cn/content/www/cn/zh/embedded/products/galileo/galileo-overview.html?_ga=1.201686033.105208985.1416798644
5. Galileo開發板主頁:http://www.intel.cn/content/www/cn/zh/education/higher-education/galileo-development-board.html
?本文轉自靈動生活博客園博客,原文鏈接:http://www.cnblogs.com/dearsj001/p/WindowsIoT.html,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的Wintel物联网平台-Windows IoT新手入门指南的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: celery delay 没反应
- 下一篇: Java GC垃圾回收机制
