A Pin no "Input floating" mode?

Posted on
  • If I want a Pin stay in Input floating mode upon power up, how can I do it?

    Sometines I make a GPIO pin for DI,DO, it's not okay that the pin stay always 0 when the board power on, no matter I set the pin mode "input" or "output".

  • The pins should stay floating by default on boot. It would only be if you did save() when a pin state was already set up that Espruino would remember what the pin was set to

  • What if the Pin stay floating by default on boot, use digitalRead(PIN), what result should I get?
    But I always got 0

  • It will switch to input mode, try with pin.getMode() to see after calling digitalRead.

    Also there is now no explicit mode name to set it to be disconnected/floating again (e.g. like pin.mode("disconnected")). on nrf52 devices analogRead does that. In fact floating pins on nrf52 are reported as "analog" (even for pins 4-27 that cannot be used for analog reading) and pin.mode("analog") seems to set it floating/disconnected - at least on nrf52 platform.

  • oh, and to topic title name - input mode is not floating, input mode (at least on nrf52) is sensing the input and draws some power, to save battery it should be in disconnected mode if not used, then it is really floating. On powerup it is in such mode if not used.

  • I read a statement about stm32F4, it said that this kind of chip can be individually configured by software in several modes, include input floating. However, the Espruion system did not have input floating, and initially I coded Pin.getInfo(), it shown that its' mode was analog.
    Even though I reset(true) the system, its' default mode is still analog. I have no idea how to use input floating mode as default, or I have no idea where its'mode was changed from input floating to analog.

  • its' default mode is still analog. I have no idea how to use input floating mode as default

    yes so that's fine, as I tried to explain in post #4, this is what espruino shows when pin is floating (i.e. is not set to input nor output)

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

A Pin no "Input floating" mode?

Posted by Avatar for user109783 @user109783

Actions