Skip to content
Simple command line interface to toggle PiFace outputs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Simple command line interface to toggle PiFace outputs


Note: I am using the Python3 version of pifacedigitalio, so my examples will use Python3, but I assume that it will work the same with the Python2 version of pifacedigitalio.


  -h, --help            show this help message and exit
  -a ACTION, --action=ACTION
                        action to be taken: toggle, on, off. Default = toggle
  -n NUMBER, --number=NUMBER
                        which number output to change: 0 to 7. Default = 0


python3 -n 7 
#toggle output number 7

python3 --number 6 
#toggle output number 6

python3 -a on -n 5 
#turn output number 5 On. 
#if output number 5 is already on, nothing will happen.

###Suggested Applications

For a simple timer, set up a cron job that turns an output on or off at a certain time.

crontab -e
#access cron tab

#add the following to the cron tab to automatically call the sript at certain times

0 6 * * * python3 /path/to/script/ -a on -n 7
#turn output 7 on at 6 am

0 18 * * * python3 /path/to/script/ -a off -n 7
#turn output 7 off at 6 pm
You can’t perform that action at this time.