bcm2835 1.75
blink.c

Blinks RPi GPIO pin 11 on and off

// blink.c
//
// Example program for bcm2835 library
// Blinks a pin on an off every 0.5 secs
//
// After installing bcm2835, you can build this
// with something like:
// gcc -o blink blink.c -l bcm2835
// sudo ./blink
//
// Or you can test it before installing with:
// gcc -o blink -I ../../src ../../src/bcm2835.c blink.c
// sudo ./blink
//
// Author: Mike McCauley
// Copyright (C) 2011 Mike McCauley
// $Id: RF22.h,v 1.21 2012/05/30 01:51:25 mikem Exp $
#include <bcm2835.h>
#include <stdio.h>
// Blinks on RPi Plug P1 pin 11 (which is GPIO pin 17)
#define PIN RPI_GPIO_P1_11
int main(int argc, char **argv)
{
// If you call this, it will not actually access the GPIO
// Use for testing
// bcm2835_set_debug(1);
if (!bcm2835_init())
return 1;
// Set the pin to be an output
// Blink
while (1)
{
// Turn it on
// wait a bit
// turn it off
// wait a bit
}
return 0;
}
#define HIGH
Definition: bcm2835.h:685
#define LOW
Definition: bcm2835.h:687
@ BCM2835_GPIO_FSEL_OUTP
Definition: bcm2835.h:889
void bcm2835_gpio_write(uint8_t pin, uint8_t on)
Definition: bcm2835.c:590
void bcm2835_delay(unsigned int millis)
Definition: bcm2835.c:539
void bcm2835_gpio_fsel(uint8_t pin, uint8_t mode)
Definition: bcm2835.c:302
int bcm2835_close(void)
Definition: bcm2835.c:2163
int bcm2835_init(void)
Definition: bcm2835.c:2008