I see a lot of people on the gitter feed doing things like
new pin(2)
to get GPIO pin 2 on ESP8266, instead of using the predefined D2 pin, or just doing digitalWrite(2,1); I had never seen that sort of pattern, and I'm really sort of confused as to why people use it.
If it's not a recommended method, we should figure out what's causing people to get confused and think they need to do it. It's typically getting asked by people who look like they're totally new to Espruino, too - somehow they're getting the idea they need to instantiate pin instances, which makes Espruino look less user friendly than it is. The pins are already there ready and waiting for you!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I see a lot of people on the gitter feed doing things like
new pin(2)
to get GPIO pin 2 on ESP8266, instead of using the predefined D2 pin, or just doing digitalWrite(2,1); I had never seen that sort of pattern, and I'm really sort of confused as to why people use it.
If it's not a recommended method, we should figure out what's causing people to get confused and think they need to do it. It's typically getting asked by people who look like they're totally new to Espruino, too - somehow they're getting the idea they need to instantiate pin instances, which makes Espruino look less user friendly than it is. The pins are already there ready and waiting for you!