Well I have had my Pi for just about two weeks and I have very mixed feelings about it. It is not much good for doing stuff where you need a times access to the input or output pins. Like it is totally useless for sampling an audio signal from an A/D as the interrupts can steal up to 10mS of time off you at random. Then and again you can probably get a plug in USB microphone and drivers to use it.
Anyway I have just made a simple buffer board and put the write up on line along with a simple little video.
http://www.thebox.myzen.co.uk/Raspberry/Buffer_Board.html
The code to flash a few LEDs is much more complex than an Arduino, this is what I used for that project:-
// LED light chase by Mike Cook June 2012
//
// Based on:-
// How to access GPIO registers from C-code on the Raspberry-Pi
// Example program
// 15-January-2012
// Dom and Gert
//
// Access from ARM Running Linux
#define BCM2708_PERI_BASE 0x20000000
#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define PAGE_SIZE (4*1024)
#define BLOCK_SIZE (4*1024)
int mem_fd;
char *gpio_mem, *gpio_map;
char *spi0_mem, *spi0_map;
// normal order of output pins
//char pins[] = { 1, 4, 7, 8, 9, 10, 11, 17, 18, 21, 22, 23, 24, 25 };
// order of output pins to make a chase sequence
char pins[] = { 4, 8, 10, 17, 21, 23, 25, 24, 22, 18, 11, 9, 7, 1 };
// I/O access
volatile unsigned *gpio;
// GPIO setup macros. Always use INP_GPIO(x) before using OUT_GPIO(x) or SET_GPIO_ALT(x,y)
#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
#define OUT_GPIO(g) *(gpio+((g)/10)) |= (1<<(((g)%10)*3))
#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
#define GPIO_SET *(gpio+7) // sets bits which are 1 ignores bits which are 0
#define GPIO_CLR *(gpio+10) // clears bits which are 1 ignores bits which are 0
void setup_io();
void delay(int del);
int main(int argc, char **argv)
{ int g,rep;
// Set up gpi pointer for direct register access
setup_io();
// Switch GPIO 7..11 to output mode
/************************************************************************\
* You are about to change the GPIO settings of your computer. *
* Mess this up and it will stop working! *
* It might be a good idea to 'sync' before running this program *
* so at least you still have your code changes written to the SD-card! *
\************************************************************************/
// Set all exposed GPIO pins to output
for (g=0; g<=32; g++)
{
if( ((1<<g) & 0x3e6cf93) != 0){
INP_GPIO(g); // must use INP_GPIO before we can use OUT_GPIO
OUT_GPIO(g);
}
}
GPIO_CLR = 0x3e6cf93; // clear all output pins
for(; ;){
for (rep=0; rep<14; rep++)
{ GPIO_SET = 1<<pins[rep];
delay(50); }
for (rep=0; rep<14; rep++)
{ GPIO_CLR = 1<<pins[rep];
delay(50); }
}
return 0;
} // main
void delay(int del){
int i, j, dum;
for(i=0; i<del; i++){
for(j=0; j<0x1180; j++){
dum = INP_GPIO(0); // dummy read to stop compiler optimising this away
}
}
}
//
// Set up a memory regions to access GPIO
//
void setup_io()
{
/* open /dev/mem */
if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) {
printf("can't open /dev/mem \n");
exit (-1);
}
/* mmap GPIO */
// Allocate MAP block
if ((gpio_mem = malloc(BLOCK_SIZE + (PAGE_SIZE-1))) == NULL) {
printf("allocation error \n");
exit (-1);
}
// Make sure pointer is on 4K boundary
if ((unsigned long)gpio_mem % PAGE_SIZE)
gpio_mem += PAGE_SIZE - ((unsigned long)gpio_mem % PAGE_SIZE);
// Now map it
// gpio_map = (unsigned char *)mmap(
gpio_map = ( char *)mmap(
(caddr_t)gpio_mem,
BLOCK_SIZE,
PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_FIXED,
mem_fd,
GPIO_BASE
);
if ((long)gpio_map < 0) {
printf("mmap error %d\n", (int)gpio_map);
exit (-1);
}
// Always use volatile pointer!
gpio = (volatile unsigned *)gpio_map;
} // setup_io
Just the video is here:-