Due to popularity of the NodeMCU firmware, many ESP8266 boards have the wrong gpio pin numbering on them -- compatible with how NodeMCU for some reason remaps them. I wonder if it would be helpful to have a simple compatibility layer for users of such boards, so that they can use the numbers that they see on their boards.
Right now I'm thinking about including something like nodemcu.py in the scripts, with something like this:
Code: Select all
import machine
class Pin(machine.Pin):
def __init__(self, index, *args, **kwargs):
super(Pin, self).__init__((16, 5, 4, 0, 2, 14, 12, 13, 15, 3, 1, 9, 10)[index], *args, **kwargs)
And then the users could replace their "from machine import Pin" with "from nodemcu import Pin". What do you think?