/* * blink.c: * blinks the first LED * Gordon Henderson, projects@drogon.net */ #include <stdio.h> #include <wiringPi.h> int main (void) { printf ("Raspberry Pi blink\n") ; if (wiringPiSetup () == -1) return 1 ; pinMode (0, OUTPUT) ; // aka BCM_GPIO pin 17 for (;;) { digitalWrite (0, 1) ; // On delay (500) ; // mS digitalWrite (0, 0) ; // Off delay (500) ; } return 0 ; }
copy ker Raspberry Pi menggunakan winSCP
compile file blink.c, jalankan pada terminal :
gcc -o blink blink.c -lwiringPiJalankan dengan akses root :
sudo ./blink