Created
September 20, 2012 09:39
-
-
Save priyank/3754936 to your computer and use it in GitHub Desktop.
A sample C program to test the wiringPi library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment