manniru
9/20/2012 - 9:39 AM

A sample C program to test the wiringPi library

A sample C program to test the wiringPi library

/*
 * blink.c:
 * Simple test program to blink an LED on pin 7
 */

#include <wiringPi.h>
#include <stdio.h>

int main(void)
{
  int pin = 7;
  printf("Raspberry Pi wiringPi blink test\n");

  if (wiringPiSetup() == -1)
    exit (1);

  pinMode(pin, OUTPUT);

  for (;;){
    printf("LED On\n");
    digitalWrite(pin, 1);
    delay(250);
    printf("LED Off\n");
    digitalWrite(pin, 0);
    delay(250);
  }

  return 0;
}