Page 2 of 21
Chapter 2
Page 28
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
printf("Hello C World");
int test = 42;
printf("%d\n", test);
return (EXIT_SUCCESS);
}
Chapter 3
Page 47
#include <bcm2835.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if (!bcm2835_init())
return 1;
bcm2835_gpio_fsel(RPI_BPLUS_GPIO_J8_07, BCM2835_GPIO_FSEL_OUTP);
while (1)
{
bcm2835_gpio_write(RPI_BPLUS_GPIO_J8_07, HIGH);
bcm2835_delay(500);
bcm2835_gpio_write(RPI_BPLUS_GPIO_J8_07, LOW);
bcm2835_delay(500);
}
bcm2835_close();
return 0;
}