Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr2976 :: A walk through my PifaceCAD Python code – Part 4

This is the last show in the series and covers the main program section at the bottom of my script

<< First, < Previous, Latest >>

Hosted by MrX on 2019-12-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. http://www.voidspace.org.uk/python/weblog/arch_d7_2009_12_19.shtml#e1138

Now the series is open to all.

This is the last show in the series. The series was recorded in one go and split into multiple parts. This last section is pretty short; it covers the main program section at the bottom of my script that calls all the other functions and allows the user to quit the program. In this episode I also mention explanatory notes that I included in my script. These are mainly for my own benefit so I could remember how I set up lirc. I’ve included these notes at the end of these show notes.

Main program
Turn LCD backlight on, print System up message to LCD, wait a few seconds then clear screen. Activate push buttons on control and display board. Activates various IR buttons waiting on input from the remote control. Print quit message to terminal, waiting for input, repeat message until q is entered by user. When q is entered deactivate buttons and turn LCD backlight off.

Below are my Lirc explanatory comments at the end of my Python script.

lirc
This is the Linux IR control program
LIRC (Linux Infrared remote control) is an open source package that allows users to receive and send infrared signals with a Linux-based computer system.

Irrecord
Tool used to record valid IR codes from your remote control. It generates the file /etc/lirc/lircd.conf, possibly overwrites original file so use with caution. It attempts to recognise your remote control from a series of button pushes. If the remote is not recognised then it captures the codes in raw mode, I abandoned this tool and got a valid IR file for a very similar remote control on the internet, see info below

/etc/lirc/lircd.conf
File used to store IR codes for your remote control, either using the tool irrecord or from somewhere on the internet. This file is a direct copy of file "BN59-00861A-SAMSUNG-TV.conf" I added the Samsung TV string to the file name.

irw
Tool used to get the key names for your particular remote control, for this to work you must first have a valid /etc/lirc/lircd.conf file

~/.lircrc
This file is used to store the remote control key names that you want to activate, and what action is to be taken when the button is pushed. Adding the field "remote =" allows the use of multiple remote controls. The remote control key names can be found by using the command "irw", I created a file called ~/scripts/remote-key-names-sorted.txt to store the valid key names for my Samsung remote control

~/scripts/remote-key-names-sorted.txt
List of valid remote control key names for my Samsung remote control, this was generated using the irw command. I used the "tee" command to pipe output to the screen and write output to this file at the same time, see file for further details of commands I used.


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 ?