How do you program a Raspberry Pi


8 posts
by Hammond7372 » Mon Nov 14, 2011 10:12 pm
:)

How do you program a Raspberry Pi ?
Posts: 26
Joined: Mon Nov 14, 2011 10:07 pm
by emercer » Mon Nov 14, 2011 10:22 pm
If you stick to the default Linux environment, then the answer is \"just like any other Linux machine: you pick a language and a compatible compiler and program away\". There are many entry-level languages to choose from, depending on your personal taste.
User avatar
Posts: 165
Joined: Sun Aug 07, 2011 1:54 am
Location: Sao Paulo, Brazil
by mikeanthonywild » Mon Nov 14, 2011 10:26 pm
I think the RPi will focus on Python which I believe is being shipped with it. In regards to programming the RPi, Python is basically a Write Once Run Anywhere language. So what you write in Python on one PC should run exactly the same on another computer, even if it\'s completely different (like a Macbook and an RPi for example).

Python has brilliant documentation, and a good tutorial here:
http://docs.python.org/tutorial/

Although this requires prior knowledge of programming. I would recommend this book if you\'ve never touched a programming language before:
http://www.amazon.com/Python-Programming-Absolute-Beginner-Michael/dp/1592000738
Posts: 32
Joined: Mon Nov 07, 2011 10:18 pm
by Nexy » Mon Nov 14, 2011 10:48 pm
Do you mean how do you write a program that will run on top of Linux (or RiscOS or another operating system) on the Raspberry Pi or do you mean how to you write an operating system or code that will run on the Raspberry Pi without another operating system underneath? If my question is confusing or you don\'t know the answer, then you want the first one.

Raspberry Pi can run several different distributions (basically \"versions\") of Linux so there will be lots of ways you can program it. If you already know a programming language, chances are that there\'ll be a version of that language or something similar for one or more of the Linux distributions. If you don\'t already know a programming language, then there will likely be some easy-to-learn programming languages included or easily accessible. For example, of the two languages I originally learnt, Pascal was my favourite. Free Pascal looks to run on Linux on ARM processors (which is what the Raspberry Pi uses), so because that\'s a language I know then I\'d download that and start programming. If you know C++, the tools will probably already be built in.

Are those the sort of answers you\'re looking for, or are you looking for something more basic/beginner?
Posts: 72
Joined: Sun Oct 09, 2011 9:03 pm
by Hammond7372 » Mon Nov 14, 2011 10:48 pm
So can you get programs to run at startup and use the Rpi solely to run one program. My Dad would like to make use it to program the boiler ( not entirely sure what he has in mind but there you go :) )
Posts: 26
Joined: Mon Nov 14, 2011 10:07 pm
by jamesh » Mon Nov 14, 2011 10:48 pm
[quote][b]Quote from Hammond7372 on November 14, 2011, 22:12[/b]
:)

How do you program a Raspberry Pi ?[/quote]

With cheese. Badger cheese.

(Or you can look at the Wiki where there is a list of tested languages)
Unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11686
Joined: Sat Jul 30, 2011 7:41 pm
by AlanCox » Mon Nov 14, 2011 11:53 pm
[quote][b]Quote from Hammond7372 on November 14, 2011, 22:48[/b]
So can you get programs to run at startup and use the Rpi solely to run one program. My Dad would like to make use it to program the boiler ( not entirely sure what he has in mind but there you go :) )[/quote]

In the Linux case the kernel transfers control to a single initial program (traditionally known as \"init\") that is in the file system as /sbin/init. You can make that any specific single application of your own. Most people I know even for single purpose devices tend to use busybox to boot their application plus a shell and maybe ssh and dhcp and a couple of other bits so you can poke at it over the network or console more easily if it needs debugging.
Posts: 31
Joined: Thu Nov 10, 2011 7:11 pm
by Hammond7372 » Tue Nov 15, 2011 9:15 am
Ok thanks what\'s a busy box :) ?

Ok I found out about it here

http://en.wikipedia.org/wiki/BusyBox
Posts: 26
Joined: Mon Nov 14, 2011 10:07 pm