since: 2016/01/22
update: 2016/01/22
reference:
1. Windows IoT - Downloads
2. Windows IoT - Setup your Raspberry Pi 2
3. Windows IoT - Use SSH to connect to a Windows IoT Core device
A. 說明:
1. 需要 Windows 10 才可以安裝
2. 已在 Windows 上安裝過以下軟體:
Windows 10 IoT Core
Windows 10 IoT Core Dashboard
-----------------------------------------------------------------------------------------------
B. 可使用 ssh 登入
> Windows 上安裝 putty
-----------------------------------------------------------------------------------------------
C. ID / pass:
administrator / xxxx
2016年1月22日 星期五
Raspberry Pi: Setup For LED Pixel Art
since: 2016/01/22
update: 2016/01/22
reference:
1. Raspberry Pi and IOIO Board | PIXEL: LED ART
2. PIXEL Console App | PIXEL: LED ART
3. Overview | Web Enabled PIXEL on Raspberry Pi | Adafruit Learning System
4. Raspberry Pi and PIXEL | PIXEL: LED ART
5. RPiBlog: Installing Oracle JDK 8 on Raspberry Pi
A. Download the udev rules file.
1. 到 Downloads · ytai/ioio Wiki , 下載 Linux 版的檔案: 50-ioio.rules (另存新檔)
其內容為:
ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="0008", SYMLINK+="IOIO%n", MODE="666"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="0008", ENV{ID_MM_DEVICE_IGNORE}="1"
2. 將 50-ioio.rules 上傳到 pi 裡:
$ scp 50-ioio.rules pi@192.168.1.24:/home/pi
3. copy it to your rules directory (one time step)
$ sudo cp 50-ioio.rules /etc/udev/rules.d
4. restart udev
$ sudo restart udev
(or $ sudo /etc/init.d/udev restart)
-----------------------------------------------------------------------------------------------
B. Check IOIO recognized status
1. Plug your IOIO into a free USB port on the Raspberry Pi
2. check if it’s recognized using this command
$ ls /dev/IOIO*
/dev/IOIO0
-----------------------------------------------------------------------------------------------
C. Install Java on your Pi
1. for pi 1:
$ sudo apt-get install openjdk-7-jre
2. for pi 2:
$ sudo apt-get install openjdk-8-jre
3. 備註:
切換使用不同版本的 java 方式: (如果有安裝不同的版本)
$ sudo update-alternatives --config java
-----------------------------------------------------------------------------------------------
D. 安裝 avahi-daemon
$ sudo apt-get install avahi-daemon
-----------------------------------------------------------------------------------------------
E. Check PIXEL recognized status
1.Move the toggle switch on the side of PIXEL from the “Bluetooth” position to the “PC” position
2. Plug PIXEL into a free USB port on your Raspberry Pi using the included USB A-A cable.
3. Then check if it’s recognized using this command:
$ ls /dev/ttyACM0*
/dev/ttyACM0
-----------------------------------------------------------------------------------------------
F. 下載 PIXEL Console App
http://ledpixelart.com/console/
1. 在此使用 PIXEL: Console V2.0 版本
2. 上傳到 pi 裡:
$ scp pixelc_2_0.jar pi@192.168.1.24:/home/pi
-----------------------------------------------------------------------------------------------
G. 測試:
先將 pixelc_2_0.jar 更名成: pixelc.jar
1. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar --gif=black.gif
2. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar --gif=black.gif --write
3. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar -–zip=95050
4. $ java -jar -Dioio.SerialPorts=/dev/ttyACM0 pixelc.jar --gif=black.gif
5. $ java -jar pixelc.jar --gif=fire.gif
6. $ java -jar pixelc.jar -–zip=95050
-----------------------------------------------------------------------------------------------
H. 其他:
套件更新:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo rpi-update
others:
$ sudo apt-cache search openjdk
$ sudo apt-get install openjdk-7-jdk
$ sudo update-alternatives --config javac
update: 2016/01/22
reference:
1. Raspberry Pi and IOIO Board | PIXEL: LED ART
2. PIXEL Console App | PIXEL: LED ART
3. Overview | Web Enabled PIXEL on Raspberry Pi | Adafruit Learning System
4. Raspberry Pi and PIXEL | PIXEL: LED ART
5. RPiBlog: Installing Oracle JDK 8 on Raspberry Pi
A. Download the udev rules file.
1. 到 Downloads · ytai/ioio Wiki , 下載 Linux 版的檔案: 50-ioio.rules (另存新檔)
其內容為:
ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="0008", SYMLINK+="IOIO%n", MODE="666"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="0008", ENV{ID_MM_DEVICE_IGNORE}="1"
2. 將 50-ioio.rules 上傳到 pi 裡:
$ scp 50-ioio.rules pi@192.168.1.24:/home/pi
3. copy it to your rules directory (one time step)
$ sudo cp 50-ioio.rules /etc/udev/rules.d
4. restart udev
$ sudo restart udev
(or $ sudo /etc/init.d/udev restart)
-----------------------------------------------------------------------------------------------
B. Check IOIO recognized status
1. Plug your IOIO into a free USB port on the Raspberry Pi
2. check if it’s recognized using this command
$ ls /dev/IOIO*
/dev/IOIO0
-----------------------------------------------------------------------------------------------
C. Install Java on your Pi
1. for pi 1:
$ sudo apt-get install openjdk-7-jre
2. for pi 2:
$ sudo apt-get install openjdk-8-jre
3. 備註:
切換使用不同版本的 java 方式: (如果有安裝不同的版本)
$ sudo update-alternatives --config java
-----------------------------------------------------------------------------------------------
D. 安裝 avahi-daemon
$ sudo apt-get install avahi-daemon
-----------------------------------------------------------------------------------------------
E. Check PIXEL recognized status
1.Move the toggle switch on the side of PIXEL from the “Bluetooth” position to the “PC” position
2. Plug PIXEL into a free USB port on your Raspberry Pi using the included USB A-A cable.
3. Then check if it’s recognized using this command:
$ ls /dev/ttyACM0*
/dev/ttyACM0
-----------------------------------------------------------------------------------------------
F. 下載 PIXEL Console App
http://ledpixelart.com/console/
1. 在此使用 PIXEL: Console V2.0 版本
2. 上傳到 pi 裡:
$ scp pixelc_2_0.jar pi@192.168.1.24:/home/pi
-----------------------------------------------------------------------------------------------
G. 測試:
先將 pixelc_2_0.jar 更名成: pixelc.jar
1. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar --gif=black.gif
2. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar --gif=black.gif --write
3. $ java -jar -Dioio.SerialPorts=/dev/IOIO0 pixelc.jar -–zip=95050
4. $ java -jar -Dioio.SerialPorts=/dev/ttyACM0 pixelc.jar --gif=black.gif
5. $ java -jar pixelc.jar --gif=fire.gif
6. $ java -jar pixelc.jar -–zip=95050
-----------------------------------------------------------------------------------------------
H. 其他:
套件更新:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo rpi-update
others:
$ sudo apt-cache search openjdk
$ sudo apt-get install openjdk-7-jdk
$ sudo update-alternatives --config javac
標籤:
Raspberry Pi
2016年1月16日 星期六
Processing: An error occurred during startup
since: 2016/01/16
update: 2016/01/16
A. 錯誤:
Processing 2.21 無法開啟
-----------------------------------------------------------------------------------------------
B. 解決方式:
1. 可先開啟 Processing 3, 查看最下方偏好設定檔的位置.
或看 C. 備註的 3.
2. 刪除整個 "偏好設定檔目錄", 在此例為: /Users/Lanli/Library/Processing
3. 重新開啟 Processing 2
-----------------------------------------------------------------------------------------------
C. 備註:
1. Windows 與 Mac 皆適用
2. "偏好設定檔目錄" 預設為隱藏的
Windows: 目錄設定顯示所有隱藏檔
Mac: Finder > 前往 > 前往檔案夾 ...
3. Windows 與 Mac 預設的 "偏好設定檔目錄" 位置:
Windows: C:\Users\Lanli\AppData\Roaming\Processing
Mac: /Users/Lanli/Library/Processing
update: 2016/01/16
A. 錯誤:
Processing 2.21 無法開啟
B. 解決方式:
1. 可先開啟 Processing 3, 查看最下方偏好設定檔的位置.
或看 C. 備註的 3.
3. 重新開啟 Processing 2
-----------------------------------------------------------------------------------------------
C. 備註:
1. Windows 與 Mac 皆適用
2. "偏好設定檔目錄" 預設為隱藏的
Windows: 目錄設定顯示所有隱藏檔
Mac: Finder > 前往 > 前往檔案夾 ...
3. Windows 與 Mac 預設的 "偏好設定檔目錄" 位置:
Windows: C:\Users\Lanli\AppData\Roaming\Processing
Mac: /Users/Lanli/Library/Processing
標籤:
Error Handle
2016年1月15日 星期五
openFrameworks: Reading From And Writing To Files With ofBuffer Class
since: 2016/01/15
update: 2016/01/15
reference:
A. in header file:
....
/* config file */
bool debug; // debug mode: to show more message or not
float checkTime_second;
/* record datetime to file */
ofBuffer readBuffer;
ofBuffer checkTimeBuffer;
string nowDateString;
-----------------------------------------------------------------------------------------------
B. in c++ file:
1. Read File:
....
// read config file
readBuffer = ofBufferFromFile("config.txt");
//cout << readBuffer.getText(); // let's see what it says
vector<string> lines = ofSplitString(readBuffer, "\n");
for( int i = 0; i < lines.size(); i++){
//cout << lines[i] << endl;
if(i == 1) {
debug = ofToBool(lines[i]);
if(debug) {
ofLog(OF_LOG_NOTICE, ">>>>> debug true");
}
else {
ofLog(OF_LOG_NOTICE, ">>>>> debug false");
}
}
else if(i == 4) {
checkTime_second = ofToFloat(lines[i]);
ofLogNotice(">>>>>>>>> checkTime_second") << checkTime_second;
}
2. Write File:
....
// inner some loop
if(ofGetElapsedTimef() >= checkTime_second) {
ofResetElapsedTimeCounter();
nowDateString = ofGetTimestampString("%Y%m%d%H%M%S");
checkTimeBuffer.set(nowDateString.c_str(), nowDateString.size());
if(ofBufferToFile("dateTime.txt", checkTimeBuffer)) {
ofLogNotice(">>>>>>>>> update checking dateTime") << nowDateString;
}
}
update: 2016/01/15
reference:
A. in header file:
....
/* config file */
bool debug; // debug mode: to show more message or not
float checkTime_second;
/* record datetime to file */
ofBuffer readBuffer;
ofBuffer checkTimeBuffer;
string nowDateString;
-----------------------------------------------------------------------------------------------
B. in c++ file:
1. Read File:
....
// read config file
readBuffer = ofBufferFromFile("config.txt");
//cout << readBuffer.getText(); // let's see what it says
vector<string> lines = ofSplitString(readBuffer, "\n");
for( int i = 0; i < lines.size(); i++){
//cout << lines[i] << endl;
if(i == 1) {
debug = ofToBool(lines[i]);
if(debug) {
ofLog(OF_LOG_NOTICE, ">>>>> debug true");
}
else {
ofLog(OF_LOG_NOTICE, ">>>>> debug false");
}
}
else if(i == 4) {
checkTime_second = ofToFloat(lines[i]);
ofLogNotice(">>>>>>>>> checkTime_second") << checkTime_second;
}
2. Write File:
....
// inner some loop
if(ofGetElapsedTimef() >= checkTime_second) {
ofResetElapsedTimeCounter();
nowDateString = ofGetTimestampString("%Y%m%d%H%M%S");
checkTimeBuffer.set(nowDateString.c_str(), nowDateString.size());
if(ofBufferToFile("dateTime.txt", checkTimeBuffer)) {
ofLogNotice(">>>>>>>>> update checking dateTime") << nowDateString;
}
}
標籤:
Mac OS X,
openFrameworks
AppleScript: Repeat Checking App Status
since: 2016/01/15
update: 2016/01/15
A. 新增 AppleScript:
1. 開啟 Automator:
2. Automator > 檔案 > 新增 > 應用程式 > 選擇:
3. 工具程式 > 執行 AppleScript > 拖拉到右方
4. 預設程式碼:
on run {input, parameters}
(* Your script goes here *)
return input
end run
-----------------------------------------------------------------------------------------------
B. 修改 AppleScript:
on run {input, parameters}
#
# start: variables defined
#
# script repeat delay time (second)
set repeatDelayTime to 180
# dateTimeFile Path
# /Lanli/RD/project/openFrameworks/of_v0.9.0/apps/myApps/myFirstApp/bin/data/
set dateTimeFilePath to (("Lanli:RD:project:openFrameworks:of_v0.9.0:apps:myApps:myFirstApp:bin:data:") as text)
# dateTimeFile Name
set dateTimeFileName to "dateTime.txt"
# completed dateTimeFile
set dateTimeFile to dateTimeFilePath & dateTimeFileName
# allow time difference to sysDateTime & appUpdateTime (second)
set allowedSecondDiff to 120
# allowed min free memory (MB)
set allowedMinFreeMemory to 0
# my app name
set myAppName to "myFirstApp"
# reboot system or not
set reboot to false
#
# end: variables defined
#
##########################################################
#
# start script repeat
#
repeat
# delay 180 second
# delay 180
delay repeatDelayTime
# start: repeat task
##########################################################
#
# check 01: app update status
#
# Read lines from file.
set fileLines to paragraphs of (read file dateTimeFile as «class utf8»)
# Loop over lines read and copy each to the clipboard.
repeat with perLine in fileLines
set the clipboard to perLine
#display alert (the clipboard)
set appUpdateTime to (the clipboard) as integer
exit repeat # we just need read one line here
end repeat
# get sysDateTime
set sysDateTime to nowTimeFormat() as integer
# check time diff
if (appUpdateTime + allowedSecondDiff) ≥ sysDateTime then
# display dialog "you pass" with title "check app update status" buttons {"OK"} default button 1
else
# display dialog "reboot" with title "check app update status" buttons {"OK"} default button 1
set reboot to true
end if
#
# check 02: system memory free
#
# query memory free (MB)
set vmStats to (text 12 thru -2 of (do shell script "vm_stat | grep 'Pages free'")) * 4096 / 1024 / 1024
# show free Memory
#display dialog vmStats with title "Memory Free (MB)" buttons {"OK"} default button 1
# if vmStats <= 0 MB
if vmStats ≤ allowedMinFreeMemory then
set reboot to true
end if
# for test
#set reboot to false
#
# reboot system or not
#
if reboot is true then
#display dialog "reboot" with title "reboot system or not" buttons {"OK"} default button 1
#step 1: kill your app
tell application "System Events"
set ProcessList to name of every process
if myAppName is in ProcessList then
set ThePID to unix id of process myAppName
do shell script "kill -KILL " & ThePID
end if
end tell
#step 2: reboot system
tell application "Finder"
restart
end tell
else
#display dialog "pass" with title "reboot system or not" buttons {"OK"} default button 1
end if
# end: repeat task
##########################################################
# exit script repeat: for only once execute
#exit repeat
#
# end script repeat
#
end repeat
return input
end run
# nowTimeFormat
on nowTimeFormat()
set theDate to current date
set y to text -4 thru -1 of ("0000" & (year of theDate))
set m to text -2 thru -1 of ("00" & ((month of theDate) as integer))
set d to text -2 thru -1 of ("00" & (day of theDate))
set hh to text -2 thru -1 of ("00" & (hours of theDate))
set mm to text -2 thru -1 of ("00" & (minutes of theDate))
set ss to text -2 thru -1 of ("00" & (seconds of theDate))
# 2016-01-15-10-56-46
#return y & "-" & m & "-" & d & "-" & hh & "-" & mm & "-" & ss
# 20160115105646
return y & m & d & hh & mm & ss
end nowTimeFormat
update: 2016/01/15
A. 新增 AppleScript:
1. 開啟 Automator:
2. Automator > 檔案 > 新增 > 應用程式 > 選擇:
3. 工具程式 > 執行 AppleScript > 拖拉到右方
4. 預設程式碼:
on run {input, parameters}
(* Your script goes here *)
return input
end run
-----------------------------------------------------------------------------------------------
B. 修改 AppleScript:
on run {input, parameters}
#
# start: variables defined
#
# script repeat delay time (second)
set repeatDelayTime to 180
# dateTimeFile Path
# /Lanli/RD/project/openFrameworks/of_v0.9.0/apps/myApps/myFirstApp/bin/data/
set dateTimeFilePath to (("Lanli:RD:project:openFrameworks:of_v0.9.0:apps:myApps:myFirstApp:bin:data:") as text)
# dateTimeFile Name
set dateTimeFileName to "dateTime.txt"
# completed dateTimeFile
set dateTimeFile to dateTimeFilePath & dateTimeFileName
# allow time difference to sysDateTime & appUpdateTime (second)
set allowedSecondDiff to 120
# allowed min free memory (MB)
set allowedMinFreeMemory to 0
# my app name
set myAppName to "myFirstApp"
# reboot system or not
set reboot to false
#
# end: variables defined
#
##########################################################
#
# start script repeat
#
repeat
# delay 180 second
# delay 180
delay repeatDelayTime
# start: repeat task
##########################################################
#
# check 01: app update status
#
# Read lines from file.
set fileLines to paragraphs of (read file dateTimeFile as «class utf8»)
# Loop over lines read and copy each to the clipboard.
repeat with perLine in fileLines
set the clipboard to perLine
#display alert (the clipboard)
set appUpdateTime to (the clipboard) as integer
exit repeat # we just need read one line here
end repeat
# get sysDateTime
set sysDateTime to nowTimeFormat() as integer
# check time diff
if (appUpdateTime + allowedSecondDiff) ≥ sysDateTime then
# display dialog "you pass" with title "check app update status" buttons {"OK"} default button 1
else
# display dialog "reboot" with title "check app update status" buttons {"OK"} default button 1
set reboot to true
end if
#
# check 02: system memory free
#
# query memory free (MB)
set vmStats to (text 12 thru -2 of (do shell script "vm_stat | grep 'Pages free'")) * 4096 / 1024 / 1024
# show free Memory
#display dialog vmStats with title "Memory Free (MB)" buttons {"OK"} default button 1
# if vmStats <= 0 MB
if vmStats ≤ allowedMinFreeMemory then
set reboot to true
end if
# for test
#set reboot to false
#
# reboot system or not
#
if reboot is true then
#display dialog "reboot" with title "reboot system or not" buttons {"OK"} default button 1
#step 1: kill your app
tell application "System Events"
set ProcessList to name of every process
if myAppName is in ProcessList then
set ThePID to unix id of process myAppName
do shell script "kill -KILL " & ThePID
end if
end tell
#step 2: reboot system
tell application "Finder"
restart
end tell
else
#display dialog "pass" with title "reboot system or not" buttons {"OK"} default button 1
end if
# end: repeat task
##########################################################
# exit script repeat: for only once execute
#exit repeat
#
# end script repeat
#
end repeat
return input
end run
# nowTimeFormat
on nowTimeFormat()
set theDate to current date
set y to text -4 thru -1 of ("0000" & (year of theDate))
set m to text -2 thru -1 of ("00" & ((month of theDate) as integer))
set d to text -2 thru -1 of ("00" & (day of theDate))
set hh to text -2 thru -1 of ("00" & (hours of theDate))
set mm to text -2 thru -1 of ("00" & (minutes of theDate))
set ss to text -2 thru -1 of ("00" & (seconds of theDate))
# 2016-01-15-10-56-46
#return y & "-" & m & "-" & d & "-" & hh & "-" & mm & "-" & ss
# 20160115105646
return y & m & d & hh & mm & ss
end nowTimeFormat
標籤:
AppleScript,
Mac OS X
2015年12月29日 星期二
Raspberry Pi: Pi 2 with Pi Mapper update
since: 2015/12/29
update: 2016/02/18
reference:
1. PiMapper
2. openFrameworks
3. Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
4. Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3
5. Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3
A. 更新版本:
1. Raspberry Pi 2: Raspbian Jessie OS (Release date: 2015-11-21)
2. openFrameworks: v0.9.0 for linuxarmv7
-----------------------------------------------------------------------------------------------
B. 安裝作業系統影像檔:
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
2. 更新部分:
a. 下載 Raspbian 映像檔, 版本為: Raspbian Jessie (Release date: 2015-11-21)
b. 安裝好 Pi 後, 登入系統預設為桌面環境.
c. 可以直接在 Pi 的組態設定中, 設定自動使用 pi 帳號登入文字模式.
$ sudo raspi-config
> 3 Boot Options
> B2 Console Autologin Text console, automatically logged in as 'pi' user
-----------------------------------------------------------------------------------------------
C. 安裝 openFrameworks
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3
2. 更新部分:
a. download openFrameworks 0.9.0 linuxarmv7 distribution
$ cd
$ curl -O http://www.openframeworks.cc/versions/v0.9.0/of_v0.9.0_linuxarmv7l_release.tar.gz
$ mkdir openFrameworks
$ tar vxfz of_v0.9.0_linuxarmv7l_release.tar.gz -C openFrameworks --strip-components 1
b. Install packages
$ cd /home/pi/openFrameworks/scripts/linux/debian
$ sudo ./install_dependencies.sh
c. compile openFrameworks
$ make Release -j4 -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project
d. 不需要再額外增加 Raspberry Pi 2 makefiles
說明: makefiles 預設已經是 Pi 2 的了, 連結也移除了
e. 也不需要設定環境變數來告知編譯器使用 4 核與使用 armv7 來編譯
f. 編譯範例與執行:
$ cd /home/pi/openFrameworks/examples/graphics/polygonExample
$ make
$ make run
g. 在 Pi 上新增專案方式:
$ cp -R /home/pi/openFrameworks/examples/empty/emptyExample /home/pi/openFrameworks/apps/myApps/myRpiApp
$ cd /home/pi/openFrameworks/apps/myApps/myRpiApp
$ make
$ make run
-----------------------------------------------------------------------------------------------
D. 安裝 Pi Mapper
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3
2. 更新部分:
a. 下載軟體:
$ cd ~/openFrameworks/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git
b. 安裝相依軟體:
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git
c. 編譯與執行:
$ cd ~/openFrameworks/addons/ofxPiMapper/example
$ make
$ make run
d. create a symbolic link:
$ ln -s ~/openFrameworks/addons/ofxPiMapper ./PiMapper
-----------------------------------------------------------------------------------------------
E. 在 Mac 上安裝 Pi Mapper
1. 先安裝好 openframeworks
http://openframeworks.cc/download/
2. 安裝 Pi Mapper:
$ cd /Lanli/RD/project/openFrameworks/of_v0.9.0/addons
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git
$ git clone https://github.com/bakercp/ofxIO.git
$ git clone https://github.com/kr15h/ofxPiMapper.git
-----------------------------------------------------------------------------------------------
F. 在 Mac 上建立你的 Pi Mapper 專案
1. 執行 projectGenerator app
.... of_v0.9.0/projectGenerator-osx/projectGenerator.app
2. 設定內容:
Project name: myPiMapper
Addons: ofxPiMapper, ofxIO, ofxXmlSettings, ofxGui
> Generate
說明: ofxOMXPlayer 只會在 Pi 上用到, 在此處不需要加入.
3. 新增成功後, 按下 "Close", 並關閉 projectGenerator app
4. 完成後, 可以在 of_v0.9.0/apps/myApps/ 目錄下看到:
myPiMapper 專案資料夾, 底下有二個接著會用到的檔案:
addons.make ---- 編譯時會 addons 的內容
myPiMapper.xcodeproj ---- Xcode 專案檔
5. 用文字編輯器開啟 addons.make 檔案, 於最後面增加 ofxOMXPlayer
說明: ofxOMXPlayer 為 Raspberry Pi 上 openFrameworks 的 video player
6. 開啟 myPiMapper.xcodeproj 專案檔:
a. 於 src 目錄下新增以下檔案:
CustomSource.h, CustomSource.cpp
CrossSource.h, CrossSource.cpp
b. 將 of_v0.9.0/addons/ofxPiMapper/example/src 下的所有程式原始碼,
覆蓋到 of_v0.9.0/apps/myApps/myPiMapper/src 下的所有程式原始碼.
7. 拷貝 of_v0.9.0/addons/ofxPiMapper/example/bin/data 下的所有檔案與資料夾:
defaultSurfaces.xml
sources
到 of_v0.9.0/apps/myApps/myPiMapper/bin/data 下
8. 確認在 Mac 上編譯與執行成功後, 即可將整個 myPiMapper 資料夾上傳到 Pi 的
~/openFrameworks/apps/myApps 目錄下
9. 建立 soft link 並編譯執行:
$ cd
$ ln -s ~/openFrameworks/apps/myApps/myPiMapper ./myPiMapper
$ cd myPiMapper
$ make
$ make run
-----------------------------------------------------------------------------------------------
G. openFrameworks 0.9.2
1. 參考:
a. http://openframeworks.cc/setup/raspberrypi/
b. http://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/
2. 說明:
On the Raspberry 2 although it's architecture is arm7 raspbian only supports arm6 by now
3. 安裝步驟:
$ curl -O http://openframeworks.cc/versions/v0.9.2/of_v0.9.2_linuxarmv6l_release.tar.gz
$ sudo chmod 777 of_v0.9.2_linuxarmv6l_release.tar.gz
$ mkdir of_v0.9.2
$ tar vxfz of_v0.9.2_linuxarmv6l_release.tar.gz -C of_v0.9.2 --strip-components 1
$ cd /home/pi/of_v0.9.2/scripts/linux/debian
$ sudo ./install_dependencies.sh
$ sudo ./install_codecs.sh
$ make Release -C /home/pi/of_v0.9.2/libs/openFrameworksCompiled/project
4. Install PiMapper
$ cd ~/of_v0.9.2/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git
$ git clone https://github.com/jvcleave/ofxRPiCameraVideoGrabber
(for example-camera used)
5. 內建相機模組: fixed bug for example-camera: check addons.make file
ofxPiMapper
ofxIO
ofxXmlSettings
ofxGui
ofxRPiCameraVideoGrabber
ofxOMXPlayer
6. Reuse the example app by copying it to your apps directory
$ cd
$ cd
$ ln -s /home/pi/of_v0.9.2/apps/myApps/PiMapper ./PiMapper
$ cd PiMapper
$ make
$ make run
-----------------------------------------------------------------------------------------------
H. 備份與回復 Pi SD 卡資料:
1. 參考:
備份與回復樹莓派 Raspberry Pi 的 MicroSD 記憶卡 - G. T. Wang
2. 備份:
$ diskutil list ---> 查詢 SD 卡的磁碟代碼
ex: /dev/disk1
$ sudo dd if=/dev/rdisk1 of=~/Desktop/ofx_0.9.2_PiMapper.img bs=1m
3. 回復:
4. Windows 方式:
工具: Win32 Disk Imager
update: 2016/02/18
reference:
1. PiMapper
2. openFrameworks
3. Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
4. Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3
5. Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3
A. 更新版本:
1. Raspberry Pi 2: Raspbian Jessie OS (Release date: 2015-11-21)
2. openFrameworks: v0.9.0 for linuxarmv7
-----------------------------------------------------------------------------------------------
B. 安裝作業系統影像檔:
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
2. 更新部分:
a. 下載 Raspbian 映像檔, 版本為: Raspbian Jessie (Release date: 2015-11-21)
b. 安裝好 Pi 後, 登入系統預設為桌面環境.
c. 可以直接在 Pi 的組態設定中, 設定自動使用 pi 帳號登入文字模式.
$ sudo raspi-config
> 3 Boot Options
C. 安裝 openFrameworks
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3
2. 更新部分:
a. download openFrameworks 0.9.0 linuxarmv7 distribution
$ cd
$ curl -O http://www.openframeworks.cc/versions/v0.9.0/of_v0.9.0_linuxarmv7l_release.tar.gz
$ mkdir openFrameworks
$ tar vxfz of_v0.9.0_linuxarmv7l_release.tar.gz -C openFrameworks --strip-components 1
b. Install packages
$ cd /home/pi/openFrameworks/scripts/linux/debian
$ sudo ./install_dependencies.sh
c. compile openFrameworks
$ make Release -j4 -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project
d. 不需要再額外增加 Raspberry Pi 2 makefiles
說明: makefiles 預設已經是 Pi 2 的了, 連結也移除了
e. 也不需要設定環境變數來告知編譯器使用 4 核與使用 armv7 來編譯
f. 編譯範例與執行:
$ cd /home/pi/openFrameworks/examples/graphics/polygonExample
$ make
$ make run
g. 在 Pi 上新增專案方式:
$ cp -R /home/pi/openFrameworks/examples/empty/emptyExample /home/pi/openFrameworks/apps/myApps/myRpiApp
$ cd /home/pi/openFrameworks/apps/myApps/myRpiApp
$ make
$ make run
-----------------------------------------------------------------------------------------------
D. 安裝 Pi Mapper
1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3
2. 更新部分:
a. 下載軟體:
$ cd ~/openFrameworks/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git
b. 安裝相依軟體:
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git
c. 編譯與執行:
$ cd ~/openFrameworks/addons/ofxPiMapper/example
$ make
$ make run
d. create a symbolic link:
$ ln -s ~/openFrameworks/addons/ofxPiMapper ./PiMapper
-----------------------------------------------------------------------------------------------
E. 在 Mac 上安裝 Pi Mapper
1. 先安裝好 openframeworks
http://openframeworks.cc/download/
2. 安裝 Pi Mapper:
$ cd /Lanli/RD/project/openFrameworks/of_v0.9.0/addons
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git
$ git clone https://github.com/bakercp/ofxIO.git
$ git clone https://github.com/kr15h/ofxPiMapper.git
-----------------------------------------------------------------------------------------------
F. 在 Mac 上建立你的 Pi Mapper 專案
1. 執行 projectGenerator app
.... of_v0.9.0/projectGenerator-osx/projectGenerator.app
Project name: myPiMapper
Addons: ofxPiMapper, ofxIO, ofxXmlSettings, ofxGui
> Generate
說明: ofxOMXPlayer 只會在 Pi 上用到, 在此處不需要加入.
myPiMapper 專案資料夾, 底下有二個接著會用到的檔案:
addons.make ---- 編譯時會 addons 的內容
myPiMapper.xcodeproj ---- Xcode 專案檔
說明: ofxOMXPlayer 為 Raspberry Pi 上 openFrameworks 的 video player
a. 於 src 目錄下新增以下檔案:
CustomSource.h, CustomSource.cpp
CrossSource.h, CrossSource.cpp
b. 將 of_v0.9.0/addons/ofxPiMapper/example/src 下的所有程式原始碼,
覆蓋到 of_v0.9.0/apps/myApps/myPiMapper/src 下的所有程式原始碼.
7. 拷貝 of_v0.9.0/addons/ofxPiMapper/example/bin/data 下的所有檔案與資料夾:
defaultSurfaces.xml
sources
到 of_v0.9.0/apps/myApps/myPiMapper/bin/data 下
8. 確認在 Mac 上編譯與執行成功後, 即可將整個 myPiMapper 資料夾上傳到 Pi 的
~/openFrameworks/apps/myApps 目錄下
9. 建立 soft link 並編譯執行:
$ cd
$ ln -s ~/openFrameworks/apps/myApps/myPiMapper ./myPiMapper
$ cd myPiMapper
$ make
$ make run
-----------------------------------------------------------------------------------------------
G. openFrameworks 0.9.2
1. 參考:
a. http://openframeworks.cc/setup/raspberrypi/
b. http://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/
2. 說明:
On the Raspberry 2 although it's architecture is arm7 raspbian only supports arm6 by now
3. 安裝步驟:
$ curl -O http://openframeworks.cc/versions/v0.9.2/of_v0.9.2_linuxarmv6l_release.tar.gz
$ sudo chmod 777 of_v0.9.2_linuxarmv6l_release.tar.gz
$ mkdir of_v0.9.2
$ tar vxfz of_v0.9.2_linuxarmv6l_release.tar.gz -C of_v0.9.2 --strip-components 1
$ cd /home/pi/of_v0.9.2/scripts/linux/debian
$ sudo ./install_dependencies.sh
$ sudo ./install_codecs.sh
$ make Release -C /home/pi/of_v0.9.2/libs/openFrameworksCompiled/project
4. Install PiMapper
$ cd ~/of_v0.9.2/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git
$ git clone https://github.com/jvcleave/ofxRPiCameraVideoGrabber
(for example-camera used)
5. 內建相機模組: fixed bug for example-camera: check addons.make file
ofxPiMapper
ofxIO
ofxXmlSettings
ofxGui
ofxRPiCameraVideoGrabber
ofxOMXPlayer
6. Reuse the example app by copying it to your apps directory
$ cd
$ cp -R of_v0.9.2/addons/ofxPiMapper/example of_v0.9.2/apps/myApps/ $ cd of_v0.9.2/apps/myApps$ mv example PiMapper
$ cd
$ ln -s /home/pi/of_v0.9.2/apps/myApps/PiMapper ./PiMapper
$ cd PiMapper
$ make
$ make run
-----------------------------------------------------------------------------------------------
H. 備份與回復 Pi SD 卡資料:
1. 參考:
備份與回復樹莓派 Raspberry Pi 的 MicroSD 記憶卡 - G. T. Wang
2. 備份:
$ diskutil list ---> 查詢 SD 卡的磁碟代碼
ex: /dev/disk1
3. 回復:
$ sudo dd if=~/Desktop/ofx_0.9.2_PiMapper.img of=/dev/rdisk1 bs=1m
4. Windows 方式:
工具: Win32 Disk Imager
2015年12月23日 星期三
openFrameworks: Kinect For Windows V2
since: 2015/12/23
update: 2015/12/23
reference:
1. Setting up Kinect 2 for OpenFrameworks | rbarraza.com
2. elliotwoods/ofxKinectForWindows2 at 0.8.4
A. 系統需求:
1. A Kinect for Windows v2 Device (K4W2)
2. 64bit computer with a dedicated USB 3.0
3. Windows 10, 8, 8.1
4. Update your latest video card driver
5. Install DirectX 11
備註:
a. How to Check Direct X Version in Windows:
(1). Click “Start” > “Run” or hold down the “Windows Key” and press “R“.
(2). Type “dxdiag“, then click “OK“.
(3). The version of DirectX you are currently running will be displayed on your screen.
b. check your system: run the Kinect Configuration Verifier tool
-----------------------------------------------------------------------------------------------
B. 安裝軟體:
1. Kinect SDK v2
2. Visual Studio Express 2012
3. openframeworks v0.8.4
4. ofxKinectForWindows2 addon
-----------------------------------------------------------------------------------------------
C. 執行範例專案:
1. 開啟範例專案
.... openFrameworks\of_v0.8.4\addons\ofxKinectForWindows2\
example\example.sln
2. 設定為啟始專案:
3. 調整 example 與 ofxKinect4Windows2Lib 專案的 "平台工具組":
分別對 example 與 ofxKinect4Windows2Lib 專案作以下的調整:
"點選該專案" > 屬性:
所有組態 > 一般 > 平台工具組 > Visual Studio 2012 (v110)
example:
ofxKinect4Windows2Lib:
4. 建置方案與除錯:
a. 建置 > 建置方案
檢視 > 錯誤清單
b. 將紅線框內的三行程式碼作註解
5. 啟動程式:
建置 > 建置方案 > (啟動)本機 Winows 偵錯工具
-----------------------------------------------------------------------------------------------
D. 建立新的 ofxKinect For Windows2 專案:
1. 使用 OpenFrameworks 的 Project Generator 來產生新的專案:
.... openFrameworks\of_v0.8.4\projectGenerator\projectGenerator.exe
2. 設定專案名稱與要使用的 Addons:
專案名稱: KinectTest
Addons: ofxKinectForWindows2
> CREATE PROJECT
2. 開啟剛剛建立的方案:
.... openFrameworks\of_v0.8.4\apps\myApps\
KinectTest\KinectTest.sln
3. 加入 addons 的 ofxKinectForWindows2 專案:
a. 方案 > 加入 > 現有專案...
b. 瀏覽選取 ....
> ....openFrameworks\of_v0.8.4\addons\ofxKinectForWindows2
\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj
c. 完成後, 可以看到多出了一個新的專案:
ofxKinectForWindows2Lib
4. 幫專案新增 ofxKinectForWindows2.props 屬性工作表:
a. 檢視 > 屬性管理員
b. 加入現有屬性工作表
c. 瀏覽選取屬性工作表:
.... openFrameworks\of_v0.8.4\addons\
ofxKinectForWindows2\ofxKinectForWindows2.props
d. 儲存:
-----------------------------------------------------------------------------------------------
E. 調整專案配置
KinectTest 專案 > 屬性:
1. 所有組態 > 組態屬性 > VC++ 目錄 > Include 目錄 >
加入: $(KINECTSDK20_DIR)\inc
2. 所有組態 > 組態屬性 > VC++ 目錄 > 程式庫目錄 >
加入: $(KINECTSDK20_DIR)\lib\x86
3. 所有組態 > 組態屬性 > 連結器 > 一般 > 其他程式庫目錄 >
加入: $(KINECTSDK20_DIR)\Lib\x86
4. 所有組態 > 組態屬性 > 連結器 > 輸入> 其他相依性 >
加入: $(KINECTSDK20_DIR)\Lib\x86\Kinect20.lib
-----------------------------------------------------------------------------------------------
F. 撰寫程式:
1. 開啟 ofApp.h 程式, 修改如下:
#pragma once
#include "ofMain.h"
#include "ofxKinectForWindows2.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
};
2. 開啟 ofApp.cpp 程式, 修改如下:
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
kinect.open();
kinect.initBodyIndexSource();
kinect.initColorSource();
}
//--------------------------------------------------------------
void ofApp::update(){
this->kinect.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
this->kinect.getBodyIndexSource()->draw(0,0,512,424)
this->kinect.getColorSource()->draw(532,0,640,360);
}
....
-----------------------------------------------------------------------------------------------
G. 建置與執行: (只取部份畫面)
update: 2015/12/23
reference:
1. Setting up Kinect 2 for OpenFrameworks | rbarraza.com
2. elliotwoods/ofxKinectForWindows2 at 0.8.4
A. 系統需求:
1. A Kinect for Windows v2 Device (K4W2)
2. 64bit computer with a dedicated USB 3.0
3. Windows 10, 8, 8.1
4. Update your latest video card driver
5. Install DirectX 11
備註:
a. How to Check Direct X Version in Windows:
(1). Click “Start” > “Run” or hold down the “Windows Key” and press “R“.
(2). Type “dxdiag“, then click “OK“.
(3). The version of DirectX you are currently running will be displayed on your screen.
b. check your system: run the Kinect Configuration Verifier tool
-----------------------------------------------------------------------------------------------
B. 安裝軟體:
1. Kinect SDK v2
2. Visual Studio Express 2012
3. openframeworks v0.8.4
4. ofxKinectForWindows2 addon
-----------------------------------------------------------------------------------------------
C. 執行範例專案:
1. 開啟範例專案
.... openFrameworks\of_v0.8.4\addons\ofxKinectForWindows2\
example\example.sln
分別對 example 與 ofxKinect4Windows2Lib 專案作以下的調整:
"點選該專案" > 屬性:
所有組態 > 一般 > 平台工具組 > Visual Studio 2012 (v110)
example:
a. 建置 > 建置方案
檢視 > 錯誤清單
5. 啟動程式:
建置 > 建置方案 > (啟動)本機 Winows 偵錯工具
D. 建立新的 ofxKinect For Windows2 專案:
1. 使用 OpenFrameworks 的 Project Generator 來產生新的專案:
.... openFrameworks\of_v0.8.4\projectGenerator\projectGenerator.exe
專案名稱: KinectTest
Addons: ofxKinectForWindows2
> CREATE PROJECT
.... openFrameworks\of_v0.8.4\apps\myApps\
KinectTest\KinectTest.sln
a. 方案 > 加入 > 現有專案...
b. 瀏覽選取 ....
> ....openFrameworks\of_v0.8.4\addons\ofxKinectForWindows2
\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj
ofxKinectForWindows2Lib
a. 檢視 > 屬性管理員
b. 加入現有屬性工作表
c. 瀏覽選取屬性工作表:
.... openFrameworks\of_v0.8.4\addons\
ofxKinectForWindows2\ofxKinectForWindows2.props
E. 調整專案配置
KinectTest 專案 > 屬性:
1. 所有組態 > 組態屬性 > VC++ 目錄 > Include 目錄 >
加入: $(KINECTSDK20_DIR)\inc
加入: $(KINECTSDK20_DIR)\lib\x86
加入: $(KINECTSDK20_DIR)\Lib\x86
加入: $(KINECTSDK20_DIR)\Lib\x86\Kinect20.lib
F. 撰寫程式:
1. 開啟 ofApp.h 程式, 修改如下:
#pragma once
#include "ofMain.h"
#include "ofxKinectForWindows2.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
};
2. 開啟 ofApp.cpp 程式, 修改如下:
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
kinect.open();
kinect.initBodyIndexSource();
kinect.initColorSource();
}
//--------------------------------------------------------------
void ofApp::update(){
this->kinect.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
this->kinect.getBodyIndexSource()->draw(0,0,512,424)
this->kinect.getColorSource()->draw(532,0,640,360);
}
....
-----------------------------------------------------------------------------------------------
G. 建置與執行: (只取部份畫面)
標籤:
Kinect,
openFrameworks,
Windows
訂閱:
文章 (Atom)



































