SlideShare una empresa de Scribd logo
1 de 13
Silverlight にマイコンをつないでみよう 蜜葉 優
Profile H.N. :蜜葉 優 本名:泉本 優輝 職種:関西大学総合情報学部 4 回生 Twitter : mitsuba_tan Blog :  蜜葉の日記 http://d.hatena.ne.jp/c-mitsuba/
SL4 の OOB で COM が 叩けるようになりましたね!
Windows7 からセンサの API が 使えるとか、 センサ・フィジカルが流行ってますね。
マイコンを持ってきました Japanino 大人の科学 No27 の付録
センサー API に対応してないので 強引にやってみました。
マイコンのコード 単語4つをランダムで シリアル通信で送信する コードを書いています。 void loop()  {  key = random(4); switch(key%4){ case 0: Serial.println(".net4"); break; case 1: Serial.println("Silverlight"); break; case 2: Serial.println("WPF"); break; case 3: Serial.println("Azure"); break; } key++; }
C# dynamic com; private void button2_Click(object sender, RoutedEventArgs e) {  com = AutomationFactory.CreateObject(&quot;ActiveXperts.ComPort&quot;); dynamic count = com.GetDeviceCount(); StringBuilder sb = new StringBuilder(); List<dynamic> devices = new List<dynamic>(); for (int i = 1; i <= 9; i++) { devices.Add(&quot;COM&quot; + i); } for (int i = 0; i < count; i++) { devices.Add(com.GetDevice(i)); } devicelst.ItemsSource = devices; }
Beta 版からの変更点 beta 版からの変更   ComAutomationFactory Class  名前空間: System.Windows.Interop   ↓   AutomationFactory Class  名前空間:   System.Runtime.InteropServices.Automation
マイコンから値取ってくる private void Storyboard1_Completed(object sender, EventArgs e) { com.Sleep(200); buffer = com.ReadString(); if (buffer == &quot;&quot;) { com.Close(); return; } tb.Dispatcher.BeginInvoke(delegate() { tb.Text += &quot;&quot; + com.ReadString(); }); Storyboard1.Begin(); }
DEMO
さいごに ,[object Object],[object Object],[object Object]
ご清聴ありがとうございました。

Más contenido relacionado

Más de c-mitsuba

Beginning of HoloMagicians
Beginning of HoloMagiciansBeginning of HoloMagicians
Beginning of HoloMagiciansc-mitsuba
 
Build 2021 Topics & Unofficial Talks for Windows Development
Build 2021 Topics & Unofficial Talks for Windows DevelopmentBuild 2021 Topics & Unofficial Talks for Windows Development
Build 2021 Topics & Unofficial Talks for Windows Developmentc-mitsuba
 
Avalonia for MacApps
Avalonia for MacAppsAvalonia for MacApps
Avalonia for MacAppsc-mitsuba
 
nameless ある沼にDeepDiveした人のポートフォリオ
nameless ある沼にDeepDiveした人のポートフォリオnameless ある沼にDeepDiveした人のポートフォリオ
nameless ある沼にDeepDiveした人のポートフォリオc-mitsuba
 
Emotional space
Emotional spaceEmotional space
Emotional spacec-mitsuba
 
Designer’s Design Talk Azure / Windows Development 2人のMVPの場合 -
Designer’s  Design Talk Azure / Windows Development  2人のMVPの場合 -Designer’s  Design Talk Azure / Windows Development  2人のMVPの場合 -
Designer’s Design Talk Azure / Windows Development 2人のMVPの場合 -c-mitsuba
 
うるしまカップ パネルディスカッション
うるしまカップ パネルディスカッションうるしまカップ パネルディスカッション
うるしまカップ パネルディスカッションc-mitsuba
 
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 -
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 - Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 -
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 - c-mitsuba
 
30min serverless-x tuber
30min serverless-x tuber30min serverless-x tuber
30min serverless-x tuberc-mitsuba
 
HoloLensで航空管制
HoloLensで航空管制HoloLensで航空管制
HoloLensで航空管制c-mitsuba
 
Introducing micro:bit and demo
Introducing micro:bit and demoIntroducing micro:bit and demo
Introducing micro:bit and democ-mitsuba
 
micro:bitさわってみた。
micro:bitさわってみた。micro:bitさわってみた。
micro:bitさわってみた。c-mitsuba
 
HoloLens Demo
HoloLens DemoHoloLens Demo
HoloLens Democ-mitsuba
 
楽しく生きるために 何を選択して、どうしてきたか。
楽しく生きるために 何を選択して、どうしてきたか。楽しく生きるために 何を選択して、どうしてきたか。
楽しく生きるために 何を選択して、どうしてきたか。c-mitsuba
 
Dotnetlab: Introducing Fluent Design System and Mixed Reality
Dotnetlab: Introducing Fluent Design System and Mixed RealityDotnetlab: Introducing Fluent Design System and Mixed Reality
Dotnetlab: Introducing Fluent Design System and Mixed Realityc-mitsuba
 
to tanzanite
to tanzanite to tanzanite
to tanzanite c-mitsuba
 
Introduction Xamarin forms mac
Introduction Xamarin forms macIntroduction Xamarin forms mac
Introduction Xamarin forms macc-mitsuba
 
Tried to touch Xamarin Forms for MacOS
Tried to touch Xamarin Forms for MacOSTried to touch Xamarin Forms for MacOS
Tried to touch Xamarin Forms for MacOSc-mitsuba
 

Más de c-mitsuba (20)

Beginning of HoloMagicians
Beginning of HoloMagiciansBeginning of HoloMagicians
Beginning of HoloMagicians
 
Build 2021 Topics & Unofficial Talks for Windows Development
Build 2021 Topics & Unofficial Talks for Windows DevelopmentBuild 2021 Topics & Unofficial Talks for Windows Development
Build 2021 Topics & Unofficial Talks for Windows Development
 
Avalonia for MacApps
Avalonia for MacAppsAvalonia for MacApps
Avalonia for MacApps
 
Me
MeMe
Me
 
nameless ある沼にDeepDiveした人のポートフォリオ
nameless ある沼にDeepDiveした人のポートフォリオnameless ある沼にDeepDiveした人のポートフォリオ
nameless ある沼にDeepDiveした人のポートフォリオ
 
Emotional space
Emotional spaceEmotional space
Emotional space
 
Designer’s Design Talk Azure / Windows Development 2人のMVPの場合 -
Designer’s  Design Talk Azure / Windows Development  2人のMVPの場合 -Designer’s  Design Talk Azure / Windows Development  2人のMVPの場合 -
Designer’s Design Talk Azure / Windows Development 2人のMVPの場合 -
 
うるしまカップ パネルディスカッション
うるしまカップ パネルディスカッションうるしまカップ パネルディスカッション
うるしまカップ パネルディスカッション
 
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 -
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 - Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 -
Designer’s Design Talk - Azure / Windows Development 2人のMVPの場合 -
 
30min serverless-x tuber
30min serverless-x tuber30min serverless-x tuber
30min serverless-x tuber
 
HoloLensで航空管制
HoloLensで航空管制HoloLensで航空管制
HoloLensで航空管制
 
Introducing micro:bit and demo
Introducing micro:bit and demoIntroducing micro:bit and demo
Introducing micro:bit and demo
 
micro:bitさわってみた。
micro:bitさわってみた。micro:bitさわってみた。
micro:bitさわってみた。
 
HoloLens Demo
HoloLens DemoHoloLens Demo
HoloLens Demo
 
楽しく生きるために 何を選択して、どうしてきたか。
楽しく生きるために 何を選択して、どうしてきたか。楽しく生きるために 何を選択して、どうしてきたか。
楽しく生きるために 何を選択して、どうしてきたか。
 
Dotnetlab: Introducing Fluent Design System and Mixed Reality
Dotnetlab: Introducing Fluent Design System and Mixed RealityDotnetlab: Introducing Fluent Design System and Mixed Reality
Dotnetlab: Introducing Fluent Design System and Mixed Reality
 
WinMR入門
WinMR入門WinMR入門
WinMR入門
 
to tanzanite
to tanzanite to tanzanite
to tanzanite
 
Introduction Xamarin forms mac
Introduction Xamarin forms macIntroduction Xamarin forms mac
Introduction Xamarin forms mac
 
Tried to touch Xamarin Forms for MacOS
Tried to touch Xamarin Forms for MacOSTried to touch Xamarin Forms for MacOS
Tried to touch Xamarin Forms for MacOS
 

VSUG_LT Silverlight&Arduino