• Sat 2020.09.19

    Hi @bk, I sense a bit of frustration, but please look at it from my end. I have no reference to what it is you feel is incorrect. I suggested the inclusion of a link, and that still hasn't been supplied. So from my view, not being able to 'see' what it is being attempted, nor am I able to 'see' how the circuit is wired. Now, through experience, I might be able to visulaize what is being attempted, but again, I'm not going to just guess.

    As is in the documentation, it is suggested that a new user start with an 'Official Supported Board' as the evolution of Espruino and it's development along with all the documentation were created specifically for Original boards that @Gordon developed. From that complexity we can't just expect the documentation to work for all boards out there.

    See note beneath the board listings:

    http://www.espruino.com/Other+Boards

    There are several in the community willing to assist, and @MaBe has extended his expertise using the ESP8266. Now having several years under my belt, I understand the explanation, but a lot of assumptions have been made. Mine from the side of how things are wired, as it appeared to me to be a hardware thing, more so than that of software.


    'So basically we need to figure out manually what type of code will work?'

    To answer this accurately, will require me to look at what documentation is being considered incorrect. It is likely (yes another S.W.A.G. response) that the documentation was for a specific circuit, and the attempt being made now isn't exactly that same circuit.

  • Actually I am not frustrated but trying to figure out how can I use esp8266 with espruino firmware, especially digitalRead() and digitalWrite() correctly. Anyways, it seems to be a bit weird that on

    digitalWrite(D2, true)
    

    or

    digitalWrite(D1, 1)
    

    LED does gets turned off. I tried on multiple esp8266 board but same results.
    And

    D2.set();
    

    and

    D2.reset();
    

    Feels much more inconvenient but it works as mentioned by @MaBe.
    And I am referring https://www.espruino.com/Reference
    for documentation.

  • The Espruino reference is accurate for official boards. The ESP8266, being a community port and manufactured by parties other than Espruino, may wire things up differently as @Robin has mentioned several times.

    You seem to be under the impression that a "1" or a "true" means on, while a "0" or a "false" means off. Those really are just conventions, and will do different things depending on how things are wired. Sending "true" just means pulling the gpio up, while sending "false" means pulling it down (to ground).

    There's a good explanation on stackoverflow: https://electronics.stackexchange.com/qu­estions/20740/why-are-pull-up-resistors-­more-common-than-pull-down-resistors which talk about switches; however since we're talking about LEDs one possible reason is that that in this case LED is wired to be pulled up in hardware; hence when setting the gpio low the LED turns on (because the circuit is complete) while setting the gpio high the LED turns off (because there is no voltage potential anymore).

    We don't have the schematics so we can't know for sure. The official boards have schematics of course so we can inspect that and know for sure.

    That said, there are ways to "invert" the logic so it's more "intuitive" but that involves possible issues with backwards compatibility on future firmware upgrades. Another one is to update the documentation on the ESP8266 specific page to mention this fact (then again, with all the different manufacturers of ESP8266 modules how do we know for sure which one we're working with?)

About

Avatar for bk @bk started