I am running a try {} block in which i test each possible pin name to see if it will respond to a digitalWrite.
var pins = [A0,A1,A2,A3,A4,A5,A6,A7,A8,A10, B1,B2, B3,B4,B5,B6,B7,B8,B9,B10]; var i; for (i = 0; i < pins.length; i++) { var pintrial = true; try { digitalWrite(pins[i],1); digitalWrite(pins[i],0); } catch(e) { pintrial = false; console.log(e); } finally { console.log(pintrial); } }
Neither B2 or A9 exist on the pico board, but B2 is accepted by this pin testing approach and A9 causes the device to disconnect itself.
Does anybody have an explanation for this? I can work around it, but I'm curious nonetheless.
@user66772 started
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 am running a try {} block in which i test each possible pin name to see if it will respond to a digitalWrite.
Neither B2 or A9 exist on the pico board, but B2 is accepted by this pin testing approach and A9 causes the device to disconnect itself.
Does anybody have an explanation for this? I can work around it, but I'm curious nonetheless.