davros at bellaliant.net
Fri Aug 28 19:40:24 CEST 2015
Thanks for the replies, everyone.
Two of you suggested I ask in comp.sys.raspberry-pi. We leave in a world
where people cannot tell you the difference between the world wide web
and the Internet and tech support for my ISP once told me in response to
mentioning that thei news server was not functioning properly that I
should "try turning on cookies" and further suggested I speak to the
"owner of usenet" for help. Because of this new world it never occured to
me that a new newsgroup would have been created in the last five years. I
expected to be laughed at if I asked about Raspberry Pi having a presence
on usenet. So thank you both for suggesting it. I will absolutely move my
question there then come back here for more straight forward pure Python
Dennis replied in detail and asked a question of me.
> I don't see you doing anything with the LED...
As I mentioned in my original post I intend to turn LED lights a
different colour but for developmented purposes I anm replace the code
for that with a print statement. LED variable was leftover from the
original script and I forgot to delete that line when sharing the
>What is "channel"?
Channel is something that is in every GPIO library example, and I pretty
sure it is literal, not a placeholder. If I replace it with channel
numbers it gives more errors. Channel is in place in working script
examples you can download.
> timered is not declared "global", so will be considered local
Rereading global variables info. Never understood why all variables
aren't always global at all times in any language. Why would you not want
the variable accessible whenever you wanted it? Maybe it is related to
performance or something. Anyway, will look at the scopes of variables
again and look at the code again.
> You initialize "colour" to 1, and then loop until "colour" is NOT
I thought the existance of the other callbacks would be able to interupt
it. Thanks for another point for me to look into and learn about.
> You start an infinite loop, nothing below this point will be
The start of the infinite sleep loop is nessecary to have the script go
reiterate instead of run once in under a second and stop. Not saying this
has to be the way to do it, just explaining why I did it. What I used was
the example used in dozens and dozens of answers given online to solve
that same problem when using RPI.GPIO.
> The exit handler will not be defined...
> Ugh... Please read up on Python string interpolation (or format
>depending on Python version)
Not sure what you are saying about that part of the code because it is
the one part of the code that works perfectly. I copied from a generic
example to start with and added my own text and ANSI codes and in every
test it does what it is supposed exactly as it is supposed to.
In addition to wanting to say thanks for your comments, I would like to
say thanks for your example pseudo-code. I appreciate it and will, like
you warned, keep in mind you do not have a Pi.
Thanks everyone who replied to my questions for that matter.
Now that I finnally have some time to work on this weekend I will take
all your comments in and look at the code suggestions provided. Thank you.
More information about the Python-list