Raspberry Pi Python Menu Programming For RPi Automation Via Command Line
Raspberry Pi Python Menu Programming For RPi Automation Via Command Line
This is for python menu programming for Automation
Below is an example of how a python or c code command to control gpio pin on a Raspberry Pi
where 8 is the pin / gpio number and 0 or 1 at the end is digital switch mode on or off (1 = on, 0=off).
will turn pin 8 off
To turn it on
In some cases 1 is off and 0 is on this isa little confusing but its todo with the configuration of the relay wireing where you can have either relays set to normally on or normally off, its that simple!
Fist you will need your rpi setup and ftp, ssh and apache2 web server (mysql database server - optional)
login remotely or locally
I use Putty to ssh in from windows to the rpi
goto /home/pi/
and create a new folder called scripts
navigate to that directory using cd (you can use ls to list out files in that directory)
now create a new directory called menu
now upload your menu.py file (i used filezilla)
you can execute python menu file manually or with an alias of new_menu links for example download free here.
https://app.box.com/s/2gh7zt4z56s3pxj0oz28c0tgj98foou4
Now to Bind / Alias that Menu to a Key Word For example menu on command prompt will open this new menu file.
Aliasing
https://jnet.forumotion.com/t574-example-of-how-to-setup-an-alias-from-the-cli-on-linux?highlight=alias
Bashrc to make Alias Permanent
https://jnet.forumotion.com/t574-example-of-how-to-setup-an-alias-from-the-cli-on-linux
Option menu Number 3 points to your bashrc so you can always customize that to open with nano or use gedit remotely if your on Linux machine.
If you can use gedit then use nano
At the bottom of that file put all your alias's.
Below is an example of how a python or c code command to control gpio pin on a Raspberry Pi
where 8 is the pin / gpio number and 0 or 1 at the end is digital switch mode on or off (1 = on, 0=off).
- Code:
/usr/local/bin/gpio -g write 8 0
will turn pin 8 off
To turn it on
- Code:
/usr/local/bin/gpio -g write 8 1
In some cases 1 is off and 0 is on this isa little confusing but its todo with the configuration of the relay wireing where you can have either relays set to normally on or normally off, its that simple!
Fist you will need your rpi setup and ftp, ssh and apache2 web server (mysql database server - optional)
login remotely or locally
I use Putty to ssh in from windows to the rpi
goto /home/pi/
and create a new folder called scripts
navigate to that directory using cd (you can use ls to list out files in that directory)
now create a new directory called menu
now upload your menu.py file (i used filezilla)
you can execute python menu file manually or with an alias of new_menu links for example download free here.
https://app.box.com/s/2gh7zt4z56s3pxj0oz28c0tgj98foou4
Now to Bind / Alias that Menu to a Key Word For example menu on command prompt will open this new menu file.
Aliasing
https://jnet.forumotion.com/t574-example-of-how-to-setup-an-alias-from-the-cli-on-linux?highlight=alias
Bashrc to make Alias Permanent
https://jnet.forumotion.com/t574-example-of-how-to-setup-an-alias-from-the-cli-on-linux
Option menu Number 3 points to your bashrc so you can always customize that to open with nano or use gedit remotely if your on Linux machine.
- Code:
sudo gedit /etc/bash.bashrc
If you can use gedit then use nano
- Code:
sudo nano /etc/bash.bashrc
At the bottom of that file put all your alias's.
Last edited by jamied_uk on 31st October 2015, 13:40; edited 3 times in total
Similar topics
» This command adds Python 3 as an alternative for the python command
» Securing a Python Menu With Python Encrypted Password File
» Using Raspberry Pi To Create Home Automation! and access from anywhere online!
» Python Menu For Linux Mint 18.3
» aliasing a custom menu python file
» Securing a Python Menu With Python Encrypted Password File
» Using Raspberry Pi To Create Home Automation! and access from anywhere online!
» Python Menu For Linux Mint 18.3
» aliasing a custom menu python file
Permissions in this forum:
You cannot reply to topics in this forum
|
|