TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: R.WIESER
date: 2019-11-16 09:36:00
subject: Re: Accessing GPIO pins u

Dennis,

> GPIO1 and GPIO2 are "local" names both bound to the same,
> single RPi.GPIO module.

Yep, I came to the same conclusion.   Its just one of those obvious things I
felt I had to try before posting my problem here (and used it to indicate
that I did try to solve it myself first).

> Which confirms that setmode is a one-time operation, and can not be
> changed later.

That feels like a bit of a ham-fisted approach to me.   :-\

> My suggestion... Don't use RPi.GPIO directly.

:-)   If its just /me/ I need to think about I could simply choose to use a
single pin-numbering scheme throut all my programs.   Problem solved.

The thing is that I tend to go for a broad-as-possible usability.   In this
case that means that I would like to be able to use the class as a drop-in
(by import or simple copy-pasting) in other peoples code (no, don't wake me
yet mum...), which could also be doing GPIO.

Shucks.   No .outputBCM() and .outputBOARD or BCM.ON/OFF and BOARD.ON/OFF
constants or an even a non-required pin-scheme override argument in the
.output() command itself ?

Asking for a method that will do a pinnumber translation (using its internal
tables) is probably too much to ask for too ?

So many possibilities, so many lost chances ...

Oh well.

It will probably mean I'll just write two classes for it - and try to get it
to auto-select the correct one.

Regards,
Rudy Wieser

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.