This is an old revision of the document!
Flashing an LED in C on Raspberry Pi B2
The C example “Flashing an LED using the Raspberry PI and C Programming Language” by Gert van Loo & Dom
Flashing an LED don't works on the Raspberry Pi B2. For that one small midifikation has been done, change:
#define BCM2708_PERI_BASE 0x20000000 #define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
into:
#define BCM2736_PERI_BASE 0x3F000000 #define GPIO_BASE (BCM2736_PERI_BASE + 0x200000) /* GPIO controller */
Code:
http://dernulleffekt.de/download/blink_GPIO18_BCM2835-36.c
Knowledge
The Raspberry Pi B has the SoC BM2835 and the Raspberry Pi B2 has the Soc BM2836 on the Board. That means working with the GPIOs needs different code.
GPIO Hardware
http://elinux.org/Rpi_Low-level_peripherals
Raspberry Pi GPIO Manual for Wiring, C and C++
http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/
https://learn.sparkfun.com/tutorials/raspberry-gpio
http://www.pieter-jan.com/node/15