Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr2933 :: A walk through my PifaceCAD Python code – Part 1

In this series a do whirl wind tour of the Python code I developed for my PifaceCAD board

<< First, < Previous, Latest >>

Hosted by MrX on Wednesday 2019-10-30 is flagged as Explicit and is released under a CC-BY-SA license.
Tags: Podcasts, Linux, Command Line, Python, Raspberry Pi.

Listen in ogg, spx, or mp3 format. | Comments (0)

Part of the series: A Little Bit of Python

Initially based on the podcast "A Little Bit of Python", by Michael Foord, Andrew Kuchling, Steve Holden, Dr. Brett Cannon and Jesse Noller. https://www.voidspace.org.uk/python/weblog/arch_d7_2009_12_19.shtml#e1138

Now the series is open to all.

In this series a do whirl wind tour of the Python code I developed to control my PifaceCAD raspberry pi add on board. I this use to control a music player running on a remote raspberry pi upstairs.

In this episode I cover my use of global variables.

List of global variables along with associated comments explaining what they are used for

# GLOBAL VARIABLES

RemoteDevice = "pi@192.168.1.13"
# Username and ip address of the remote device to control

SeekMin = -6
# Sets the minimum value of the variable SeekPosition

SeekMax = 6
# Sets the maximum value of the variable SeekPosition

SeekPosition = 0
# stores seek menu position,

SeekMenu = False
# used to track seek menu state, ie are we in seek menu or not

FirstPass = True
# Used to track 1st time button 5 (backlight toggle) is pushed, turns off blinkstick

LcdLightOn = False
# used to track toggle sate of backlight button 5

MenuMin = 0
# Sets the minimum value of variable "Menu"

MenuMax = 2
# Sets the maximum value of variable "Menu"

Menu = 0
# global variable used to keep trak of selected menu

IrActive = False
# used to track toggle state of active infrared buttons, when false disables
# all buttons on the remote control except the blue button.

StoredTime = 0
# Stores curent time in seconds when a button is pushed, used by double button tap feature

#GET_IP_CMD = "hostname –all-ip-addresses"
# Debian 7 wheezy, Command to get IP adress

GET_IP_CMD = "hostname --all-ip-addresses | cut -d' ' -f1"
# Debian 8 jessie, Command to get IP adress

#GET_ESSID_CMD = "iwconfig wlan0 | grep 'ESSID:' | cut -d':' -f2"
# Debian 7 wheezy, Command to get wifi ESSID

GET_ESSID_CMD = "/sbin/iwconfig wlan0 | grep 'ESSID:' | cut -d':' -f2"
# Debian 8 wheezy, Command to get wifi ESSID

GET_WIFI_STRENGTH_CMD = "/sbin/iwconfig wlan0 | grep 'Link Quality=' | awk '{ print $2 }'"
# Command to get wifi signal strength

Show Transcript

Automatically generated using whisper

whisper --model tiny --language en hpr2933.wav

<< First, < Previous, Latest >>


Comments

Subscribe to the comments RSS feed.

<< First, < Previous, Latest >>

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?
Are you a spammer →
Who hosted this show →
What does HPR mean to you ?