Skip to content

Instantly share code, notes, and snippets.

@nandenjin
Created July 25, 2018 08:12
Show Gist options
  • Save nandenjin/6c42bfa1107acf5744cfb9d2a9094e29 to your computer and use it in GitHub Desktop.
Save nandenjin/6c42bfa1107acf5744cfb9d2a9094e29 to your computer and use it in GitHub Desktop.
情報メディア特別演習
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
int STROBE = 15;
int DATA = 16;
int CLK = 1;
if (wiringPiSetup() == -1)
exit(1);
pinMode( STROBE, OUTPUT );
pinMode( DATA, OUTPUT );
pinMode( CLK, OUTPUT );
int c = 0;
//digitalWrite(STROBE,1);
//digitalWrite(CLK,1);
//digitalWrite(DATA,1);
//while(1){}
while(1){
digitalWrite(STROBE,1);
digitalWrite(CLK,0);
sleep(1);
digitalWrite(DATA,1);
sleep(1);
digitalWrite(CLK,1);
sleep(1);
if(c%8==7){digitalWrite(STROBE,0);sleep(1);}
c++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment