summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>1970-01-01 01:45:37 +0100
committerFranklin Wei <frankhwei536@gmail.com>1970-01-01 01:45:37 +0100
commit3b33d88f5621a8d40ccf4c0177c98f63a5c19c38 (patch)
treeb9fcb18e466817b2256c5b86eb56d2a2c7003efb /main.cpp
downloadpish-3b33d88f5621a8d40ccf4c0177c98f63a5c19c38.zip
pish-3b33d88f5621a8d40ccf4c0177c98f63a5c19c38.tar.gz
pish-3b33d88f5621a8d40ccf4c0177c98f63a5c19c38.tar.bz2
pish-3b33d88f5621a8d40ccf4c0177c98f63a5c19c38.tar.xz
Initial commit
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..d3ec2ae
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,34 @@
+#include <unistd.h>
+#include <led.h>
+#include <morse.h>
+#include <iostream> // let the user use this with a screen, too
+using namespace std;
+void parse_args(int argc, char* argv[])
+{
+ // nothing for now
+}
+int main(int argc, char* argv[])
+{
+ if(geteuid()!=0) // must be root to control LEDS!
+ {
+ cerr << "Need to be root to control LEDs!"<< endl;
+ cerr << "Current user ID: " << geteuid() << endl;
+ return 1;
+ }
+ parse_args(argc, argv);
+ cout << "PiSH initializied." << endl;
+ dash();
+ usleep(250000);
+ dash();
+ usleep(250000);
+ string cmd;
+ while(cmd!="exit")
+ {
+ dot();
+ cout << "PiSH> ";
+ getline(cin, cmd);
+ dash();
+ usleep(250000);
+ }
+}
+