My First Slice of Raspberry Pi

This is a step by step guide to get Mono (Open Source implementation of .Net) running on the Raspberry Pi. All the way from the beginning.

You will at least need a Pi, a memory card and a micro USB power supply. This is what I bought:

  • Raspberry Pi model B
  • SanDisk SDHC 8GB SD memory card
  • Case
  • Nano sized USB WiFi dongle
  • Micro USB power supply (the ones I had where to weak in terms of delivered current, you need 700mA for the Pi Model B).


A more comprehensive buying guide can be found at elinux.org

Raspberry Pi + WiFi Dongle + Case
Raspberry Pi + WiFi Dongle + Case

Ok let’s get started!

    1. Download NOOBS (NOOBS_v1_3_4.zip)
    2. Format SD card
    3. Unpack NOOBS
    4. Copy NOOBS to SD card
    5. Insert SD card, keyboard and display into Pi
    6. Plug in the power
    7. (Because I was using a composite cable connected to a TV I had to press the 3 key on the key board to enable the composite PAL out. The default is HDMI. More details in the official Quick Start Guide.)
    8. Install Raspbian using the very impressive NOOBS installer.
    9. Change password (during Raspbian install)
    10. Enable SSH (during Raspbian install)
    11. Debian is running on the Pi. Awesome! With many years experience with Debian and Ubuntu I felt immediately at home.
    12. Get the latest package list

    1. Install Mono

    1. Start editing a C# program

    1. Enter:

    1. Save and exit: Ctrl + X, Y, Return
    2. Compile

    1. Run it!

    1. Yay! It works! Delicious Pi!
Hello World in C# on Raspberry Pi
Hello World in C# on Raspberry Pi
    1. Another experiment is to start the C# REPL:

    1. You will get a prompt. Type “Environment.OSVersion” and press Enter, like this:

    1. I was prepared to hit the soft floar/hard float problem but it turned out I was fine. I tested with the REPL. Start REPL:

    1. Type “Math.Pow(2,4)” and press Enter, like this:

  1. 16 is the expected output.

Optional

Wireless networking

I followed this guide to enable the wireless USB dongle I bought: How to Set Up the Ralink RT5370 WiFi Dongle on Raspian

Make sure it works after reboot too. Reboot by:

Remote connect to your Raspberry Pi*

When the networking is setup on your Pi you can disconnect the display and keyboard and remote connect from your “normal” computer. First check what the ip address of your Pi is by running:

If that does not work here is another way:

Since I’m using wireless, wlan0 is the interface I’m looking for. Wired will be named eth0.

Now you know the ip address. From the command line on your “normal” computer (called Terminal on Mac and Linux):

Note that you need to have SSH enabled on the Pi. If you forgot during install, run:

Copy files to the Pi over the network*

To copy a file named MyFile.txt to your home directory (~) on the Pi:

*

Both ssh and scp are basic Unix (Mac/Linux etc) knowledge, but included here since they might not be obvious for the typical Windows C# developer – at least according to my stereotypes =)

Share on Google+Share on LinkedInTweet about this on TwitterEmail this to someoneShare on FacebookPin on Pinterest

5 thoughts on “My First Slice of Raspberry Pi

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">