Monday, 28 May 2012

Today is the first day of my Pi Journey!

Today is the first day of my Pi Journey!

This morning, the Postman delivered my long-awaited Raspberry Pi.  This is the much-hyped £25 Mini-PC that has been the talk of the country for months.  Yes, it's £25 for the Pi, but then you need to take into account other costs:

Raspberry Pi:  £24.55
VAT:  £4.91
USB Mouse (not included):  £10
USB Keyboard (not included):  £10
USB -> Micro-USB Power Cable:  £8.99
Phono Cable (video), 1.5m:  £11.99
Stereo Jack -> 2xPhono Cable (sound), 1.5m:  £6.99
16Gb SDHC Card  £8.48
TOTAL:  £86.91

So, the Pi cost me over 3 times what I expected, but I did buy decent cables, which I could probably have got much cheaper elsewhere.  The SD Card was the cheapest 16Gb I could find on Amazon, and oddly only cost me a couple of quid less than the normal price because I declined to have 'frustration-free easy-open packaging'.  I'd rather save my money and use a pair of scissors!

I downloaded the Debian 6 OS Image (from here) threw it onto the SD-Card and popped it into my Pi, connected all the cables, leaving the power lead till last.  I don't have an RJ45 network patch lead that will reach from near my TV to the router on the other side of the room, so I'll leave internet access for another day...

As soon as I plugged in the power, I got red lights on my Pi.  I quickly tuned in my TV and found the Raspberry Pi logo with a whole load of scrolling boot-up text.  Once it had done a first-time initialisation and restart, I found myself staring at the Linux bash$ cursor.

Good thing I've used Linux before in my MUD programming days - most of your lesser-spotted Windows users would think it's broke at this point, and emit cries of "Where's my mouse pointer?" and "Where's the login page?".

I browsed around a little using (pretty much) just the ls and cd commands then went back to my 'home' folder with the cd ~ command, and decided to try making something.

I fired up the pico editor (my preferred method of Linux programming), with the command pico test.c and entered the following program:
#include <stdio.h>
int main(void)
  printf("Hello, World!\r\n");
  return (0);
Pretty basic, but I just wanted to make sure it worked.  I saved (Crtl-O) and Exited (Ctrl-X) and immediately tried to compile with the bcc command.
bash: bcc:  command not found.
Hmm...  No bcc command.  OK, time to fire up the desktop and see what apps I have that will compile this for me.  I type startx and hold my breath...

Bing!  A lovely shiny desktop interface!
I hastily browse through the available options.  Windows users call it the Start Menu, but I have no idea what it's called in Linux - I guess the 'Program Menu', or 'Apps Launcher' will do.

In the Programming section, I find a load of items for doing Python, but I'm primarily a C coder - these are no good for me.  I start up the two apps called 'Squeak' and 'Scatch' but these obviously aren't what I'm looking for - I'll figure those out later.  'Geany' is the only other likely suspect, so I start it up.

Geany certainly does what I want!  I opened the C program which I made earlier, and clicked the 'Build' button (noting as I do so, that the F9 key does this without me needing to stretch my hand out towards the mouse - handy to remember for next time).

I get the lovely message telling me that my program has been successfully built!  Woo!  I made something on the Pi!  Now to make sure it works...

I logout of the desktop environment, back to the bash CLI, and type ls to find my lovely shiny new test program sitting there, patiently waiting for it's first outing.  I type ./test to run it and it gives me a warm feeling inside to see the words  Hello, World! on the next line.

OK, so it works - Time to get kids eating their tea and ready for bed - I'll turn the Pi off for now, and spend the rest of this evening browsing the web for projects and ideas and user guides.

I'll also grab some photos for you Pi-noobs of what leads I got, so you know what you'll need...

Watch this space!

No comments:

Post a Comment