You are reading a single comment by @jgw and its replies. Click here to read the full conversation.
  • Wow, that is an odd one. You could try pinMode(BTN1,'pulldown') and see if that helps?

    No... Only the simple pinMode statetment seems to help. Odd...

    >setInterval(function(){print(digitalRea­d(BTN1))},1000)
    =4
    0
    0
    // Multiple BTN1 presses
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >pinMode(BTN1,"input_pulldown")
    =undefined
    0
    // Multiple BTN1 presses
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >pinMode(BTN1)
    =undefined
    0
    // 1 BTN1 press
    0
    1
    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v10.89 (c) 2021 G.Williams
    > 
    

    Remark the Espruino prompt at the bottom : after a (detected) BTN1 press, I see the Settings/About/... screen, but no responses to BTN1 anymore. Also the setInterval seems to have stopped ??

    When you do pinMode do the 0 and 1 correspond to your actual button presses or are they random?

    The 0/1 values follow the BTN1 presses

    If you're pressing the button for >1 second then you'd expect the Loading screen to appear though as it tries to reload the default app - could that be it?

    I don't think so. I've tried to 'quickly' press BTN1. This is below 1 second, I guess

    Also when it's not working could you run getPinMode(BTN1) and...

    >
    >getPinMode(BTN1)
    ="input_pulldown"
    > 
    

    Strange...

    I continued my search after I discovered the factory reset function. This should really put everything back to a know state, I suppose. I then installed a simple setWatch :

    >
    >Bangle.factoryReset()
    Erasing Storage Area...
    Erase complete.
    Writing initial storage contents...
    Write complete.
    =undefined
    >setWatch(function(){print("Yes!")},BTN1­, {edge:"rising", debounce:50, repeat:true})
    =2
    >
    // BTN1 presses, no result
    >
    >
    >pinMode(BTN1)
    =undefined
    > 
    // BTN1 presses, no result !!!???
    

    Next I uploaded Espruino's RAM, where I found something strange - to me at least :

    //...
    setInterval(function (undefined) {return WIDGETS["bat"].draw()}, 60000); // 3
    // [native code]????
    setWatch(function () { [native code] }, D17, { repeat:true, edge:'falling', debounce : 24.99961853027 });
    setWatch(function () {print("Yes!")}, D17, { repeat:true, edge:'rising', debounce : 49.99923706054 });
    // Code saved with E.setBootCode
    //...
    
    

    Is that '[native code]' part supposed to be there ?

About

Avatar for jgw @jgw started