Expansion Board pin numbers vs LoPy pin numbers
Let me ask a naïve question, for which there is probably a very straightforward answer:
Why is the pin numbering on the expansion board (beginning with 'G') completely different from the pin numbering on the LoPy (beginning with 'P')? The expansion board numbers also are not mentioned on the newly published Pin-Out overview.
What am I missing?
Yes, the G numbers are to match the WiPy 1 (version 2 uses ESP32 like the LoPy), and the WiPy 1 in turn got their order from the GPIO pin order on the CC3200 processor it uses. LoPy's support for the G numbering is fairly explicitly to keep the expansion board the same, as the P names are all under
machine.Pin.moduleand the G names are under
machine.Pin.exp_board. By the way, those locations hold preexisting instances of all the pins, so can be used to access the few that currently crash (like G3/P16). That's one bug I plan to chase down after source release.
from machine import Pin p_out=Pin('G23',mode=Pin.OUT) p_out.id() 'P2'
Thanks Xykon, that makes sense.
Is it then correct that both Pin('Px', ......) and Pin('Gx', .......) with x being the pin number, will be recognized by micropython?
I'm assuming it was done to provide backwards compatibility for the WiPy1 expansion board.