#include #include # define ROOD 2 # define GEEL 3 # define BLAUW 4 # define GROEN 7 # define OFF 1 # define ON 2 # define TOGGLE 3 # define READ 4 /* trali.c rik 20081206 traffic light manipulation based on gpio.c http://downloads.openwrt.org/utils/gpio.tar.gz rik's first attempts at writing/hacking C changelog 20081220: default command is now ON ON will now first switch all lights off before switching on the requested lights "trali on" still effectively switches them all ON because requesting no lights at all equals requesting all of them new command: READ any command will now produce output in nagios plugin style */ int main(int argc, char **argv) { unsigned int gpio; // read-write var /dev/gpio/* unsigned int usrcol = 0 ; // user requested colours unsigned int usrcmd = ON ; // user requested command unsigned int outison ; // initially detected outputpins that are on int i ; unsigned int allcol = (1<=0; k--) { printf("%i", (n&(1<