• @Gordon,

    I know you are off the E-grid (E stands for Espruino - just to be clear) and wish you a Very Merry (late) Christmas (if in Greece - I'm still ahead of time - at least theoretically) and a Happy and Successful New Year!

    While I as messing with Charlie-Plexing bit bundles rather than single bits, pinMode() on array of pins would have come in handy... How far this array thing should go depends on the effort that has to go in as well as on the space left to squeeze more into the firmware.

    getPinMode() was initially not even on the list for these thoughts... but made it just now when thinking of completeness.

    In my case pinMode() on array with all the same settings would have helped... but why not open up the setting optionally to arrays as well? Last but least digitalWrite()/digitalRead() can do it and code reuse may help. I know you will give it a thought.

    When you do so, would it be possible to also pass on pin value / values so one could get rid of the possible jitter between the pin going for output and then setting what that output should be...

    as always: allObjects

    PS: having to use pinMode() was temporary to figure out some issues... luckily I could resort to automatic setting - reset default - and use digitalRead() and digitalWrite() - (would not have worked with open-collector-like needs).

  • Hi,

    Actually adding the ability to specify an array instead of a single pin for pinMode would be pretty easy and as you say it could be very flexible.

    As you note it is a bit of a rabbit hole though... - like supplying different modes for each pin, and then output high/low/etc.

    Right now, nothing stops you from [A,B,C].forEach(p=>p.mode("input")); which isn't too painful.

    I just answered this post and I wonder whether this isn't a very similar case. At the end of the day having a faster JS interpreter for executing a long series of function calls would probably be a lot more usable than me going around adding lots of 'bulk execution' functionality to Espruino's existing APIs.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

pinMode() / getPinMode() on array of pins like digitalWrite() / digitalRead() ?

Posted by Avatar for allObjects @allObjects