티스토리 뷰

728x90

출처

led.c

#include <stdio.h>
#include <wiringpi.h>

// #define LED 0 matches with ASUS_GPIO 164! This can be checked with command 'sudo gpio readall'.
#define LED     8

int main (void)
{
         printf ("TB blink\n");

         wiringPiSetup ();
         pinMode (LED, OUTPUT);

         for (;;)
         {
                 printf ("led on\n");
                 digitalWrite (LED, HIGH);
                 delay (500);
                 printf ("led off\n");
                 digitalWrite (LED, LOW);
                 delay (500);
         }
         return 0;
}

컴파일

$ gcc -o led led.c -lwiringPi

실행

$ ./led
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함