1 / 23

Mono on Raspberry Pi

Mono on Raspberry Pi. Using C# and .NET in unexpected places. John Waters. @ john_k_waters john.waters@cto4hire.net www.cto4hire.net/blog. Background. University of Cambridge, UK Concerned about CS skills Wanted to recreate the hobbyist $35 dollar model B.

anaya
Download Presentation

Mono on Raspberry Pi

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mono on Raspberry Pi Using C# and .NET in unexpectedplaces

  2. John Waters @john_k_waters john.waters@cto4hire.net www.cto4hire.net/blog

  3. Background University of Cambridge, UK Concerned about CS skills Wanted to recreate the hobbyist $35 dollar model B Anyone remember the BBC Micro? And Defender? Frogger?

  4. Basic setup • Connect keyboard to USB • HDMI out to screen • Ethernet connection • SD card with Raspbian • Power micro USB 700 mA • Lift off!

  5. Running headless • SSH – on by default • Connect with PuTTy or Cygwin • Or Mac Terminal • Can combine with Xwindows • For instance cygwin

  6. Where is my pi? • Static IP address? Conflicts • Dynamic? Yes, but where is it? • sudoapt-get install avahi-daemon

  7. Remoting in • sudo apt-get install xrdp • Windows Remote Desktop • Methods can be combined • Multi user OS!

  8. Sharing files • Set up FTP • apt-get install vsftpd • Edit vsftpd.conf Set up SMB (Samba) apt-get install samba samba-common-bin Edit smb.conf

  9. Wireless connectivity • EDIMax Wireless Nano USB • Edit /etc/network/interfaces • Optionally set up static IP • Set SSID and pass phrase

  10. GPS connectivity • GlobalSat BU-353 USB GPS • apt-get install gpsdgpsd-clients • sudokillallgpsd • sudogpsd /dev/ttyUSB0 –F /var/run/gpsd.sock • cpgs–s • xgps& • gpspipe -r

  11. gpsd • Sockets, JSON • Multiple GPS devices • gpspipe –r > fake.txt • gpsfake –c 3 fake.txt

  12. All set! • Custom solar panel • WiFi • GPS • FTP and Samba • SSH/Remote/XWindows • Let’s write some software!

  13. Mono

  14. Installing mono on RPi • apt-get install mono-complete • Interactive prompt, csharp • Compiler: mcs, xbuild • Run mono executable: mono • Demo: hello world! • Mono 2, Hard float, mono 3, armhf

  15. C# on RPi • Let’s write a program that interfaces with GPSD using JSON • Demo program.cs

  16. Adding references, parsing JSON What is JSON? Requesting JSON from gpsd with ?WATCH Deserializing with generics (manual Version class) The modified code cat Program2.cs Adding references for the compiler mcs -sdk:2 -r:System.Runtime.Serialization -r:System.ServiceModel.Web -r:System.Xml Program2.cs Running mono Program2.cs

  17. Mono Develop/Xamarin Studio

  18. The gpsd protocol • Handling each kind of JSON object from gpsd • Using JSON2CSharp to get type declarations • The modified Solution in Xamarin Studio • Add References • Copy to device • xbuild • But first…

  19. Calling a web service

  20. Summary • What is the Rpi? How to get it set up, headless, file sharing • Wifi and GPS devices • What is Mono, installing it and using C# on Pi • Communication with gpsd, JSON • Calling a REST Service

  21. Resources • Mono armhf 3: https://github.com/alexrp/mono/tree/armhf • Rpi Wiki: http://elinux.org/RPi_Hub • Bing Map Portal: https://www.bingmapsportal.com • JSON2CSharp: http://json2csharp.com • My blog: http://www.cto4hire.net/blog/

More Related