From 7d40cd73734b6f6330db60e1b1a8bcf9851b2dcc Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Thu, 19 Mar 2015 03:31:09 +0000 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ Makefile | 9 +++++++++ main.c | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af2bfd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +hdmi-switcher diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..620e783 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +CC = gcc -Wall + +all: hdmi-switcher + +hdmi-switcher: main.o + $(CC) main.o -o hdmi-switcher -lwiringPi + +main.o: main.c + $(CC) -O -c main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..d33d815 --- /dev/null +++ b/main.c @@ -0,0 +1,21 @@ +#include +#include + +int main (void) +{ + printf ("Short pin 7 and 9 to see something cool.\n") ; + + wiringPiSetup (); + + pinMode(7, INPUT) ; + pullUpDnControl(7, PUD_UP); + + while(1) + { + if (digitalRead(7) == LOW) //Low is pressed + printf("Nice meme.\n"); + + while(digitalRead(7) == LOW) //This just causes the loop to wait til the button is released + delay(10); + } +} -- 2.11.0