f#で動かすraspberry pi+lego mindstorms
DESCRIPTION
2014/08/03 F# Meetup in Tokyo の発表資料TRANSCRIPT
![Page 1: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/1.jpg)
F# で動かす Raspberry PI+LEGO Mindstorms
増田 智明( @moonmile ).NET ラボ Micorosft MVP C#
Moonmile Solutions
![Page 2: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/2.jpg)
自己紹介
増田 智明 [email protected]
執筆業&プログラマ C# による iOS, Android, Windows アプリケーション開発入門 逆引き大全 Visual C# 2013, Visual Basic 2013
逆引き大全 iPhone/iPad アプリ開発 作って覚える iPhone/iPad アプリ入門
![Page 3: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/3.jpg)
「ハルロック」西餅 著http://www.moae.jp/comic/harurock/1/1
つい最近知った。 電子工作の基礎な話が出てきます。
PIC
Raspberry Pi
Arduino
.NET Micro は、まだ出てきてない
モーニング連載
![Page 4: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/4.jpg)
プレゼンの目的F# は何処で使えるのか?
![Page 5: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/5.jpg)
いきなり、結論 .NET Framework があれば何処でも使えま
す
![Page 6: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/6.jpg)
ロボット制御に使おうRaspberry PiLinux/Mono
CameraOpenCV
DualSock3Bluetooth
GPIO/I2C
RobotProtocol
WiFiHTTPXAML
Xamarin.Forms
![Page 7: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/7.jpg)
Rasbpery Pi に F# を入れる
Raspberry PiLinux/Mono
Linux なので Monoが入る。
F# をビルド→ 10 時間かかる
インタプリタが動く→ 遅いが
![Page 8: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/8.jpg)
Rasbpery Pi に F# を入れる
簡易 C/S を作るHttpListenerHttpClient
適当な RESTfulWiFiHTTP
![Page 9: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/9.jpg)
Rasbpery Pi に F# を入れる
スマートフォンのクライアントXamarin.iOS/AndroidXamarin.FormsWindows Store 8.1 作成中Windows Phone 8.1 作成中Windows 8.1 WPF
XAMLXamarin.Form
s
![Page 10: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/10.jpg)
Rasbpery Pi に F# を入れる
画像解析OpenCV の C# 版
(opencvsharp) で実験する予定
CameraOpenCV
![Page 11: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/11.jpg)
Rasbpery Pi に F# を入れる
Bluetooth コントローラ/dev/input/js0 を
BinaryReader で扱えば OKDualSock3Bluetooth
![Page 12: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/12.jpg)
Rasbpery Pi に F# を入れる
シリアルポートを叩く実験中。現在は C からインポートする方式
GPIO/I2C
![Page 13: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/13.jpg)
Rasbpery Pi に F# を入れる
ロボット制御ロジックパターンマッチとか諸々は F# の得
意なところセンサーが受信したデータを解析
RobotProtocol
![Page 14: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/14.jpg)
ロボットのアームを制御する
RasPi からアームを動かす BrickPi -> LEGO でもアームが動くが、ここでは RasPi から直接行う。 RasPi -> I2C モジュール → サーボモータ で動作させるのだが、 I2C モジュールを買い忘れてた orz
購入済み。プログラミング途中
![Page 15: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/15.jpg)
ロボットからセンサーのフィードバックを受ける
BrickPi 経由で超音波センサーを使う 変換器が必要なのが分かって、現在購入中。
![Page 16: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/16.jpg)
参考文献
Rasberry Pi http://www.raspberrypi.org/
BrickPi http://www.dexterindustries.com/BrickPi/
LEGO Mindstorms EV3 http://education.lego.com/ja-jp/preschool-and-school/secondary/mindstorms-education-ev3
Arduiono http://www.arduino.cc/
meArm http://www.phenoptix.com/products/mearm-pocket-sized-robot-arm
FEZ Spider https://www.ghielectronics.com/docs/170/fez-spider
「ハルロック」 http://www.moae.jp/comic/harurock/1/1
![Page 17: F#で動かすraspberry pi+lego mindstorms](https://reader034.vdocuments.pub/reader034/viewer/2022052600/5585d682d8b42a7c4a8b4787/html5/thumbnails/17.jpg)
自前のライブラリ
BrickPiNet BrickPi を扱う C#/F# ライブラリhttps://github.com/moonmile/BrickPiNet
XFormsPreviewer Xamarin.Forms Previewer (パース部分が F# )https://github.com/moonmile/XFormsPreviewerXamarin.Forms Xaml を動的にロードするライブラリhttps://www.nuget.org/packages/Xamarin.Forms.XamlProvider/
WinXamlProiver Windows Store 8.1 Xaml 用の TypeProvider もどきhttps://github.com/moonmile/WinXamlProvider
D4Reflection リフレクションを使って Xamarin.Forms, Windows.UI.Xaml 等を一括に扱う試作ライブラリhttps://github.com/moonmile/D4Reflection