Raspberry Pi Python Menu Programming For RPi Automation Via Command Line

View previous topic View next topic Go down

Raspberry Pi Python Menu Programming For RPi Automation Via Command Line

Post by jamied_uk on 30th October 2015, 13:03

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).

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
http://jnet.forumn.biz/t574-example-of-how-to-setup-an-alias-from-the-cli-on-linux?highlight=alias

Bashrc to make Alias Permanent
http://jnet.forumn.biz/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

jamied_uk
Admin

Posts : 1981
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Raspberry Pi Python Menu Programming For RPi Automation Via Command Line

Post by jamied_uk on 30th October 2015, 13:57


jamied_uk
Admin

Posts : 1981
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum