Advertisement
vpenkoff

Untitled

Sep 4th, 2012
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4. int main(void) {
  5.     unsigned char byte, foo;
  6.     FILE *GPIOMOD;
  7.  
  8.     GPIOMOD=fopen("/dev/gpiomod", "w");
  9.     setvbuf(GPIOMOD, &foo, _IONBF, 1);
  10.     byte=1;
  11.     while (byte==64) {
  12.     printf("Byte value: %d\n", byte);
  13.     fwrite(&byte, 1, 1, GPIOMOD);
  14.    
  15.     byte <<=1;
  16.     if (byte == 0 ) byte = 1;
  17.     sleep(1);
  18.     }
  19.     fclose(GPIOMOD);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement