Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 30 of 30

Thread: Teensyduino 1.49 Beta #4

  1. #26
    Junior Member
    Join Date
    Sep 2019
    Posts
    6
    Quote Originally Posted by PaulStoffregen View Post
    Try adding this at the beginning of setup()?

    Code:
      pinMode(A1, INPUT_DISABLE);
    Does it help?
    This did the trick indeed! Thank you Paul.

    j.

  2. #27
    Senior Member
    Join Date
    Dec 2015
    Location
    LA
    Posts
    145
    Quote Originally Posted by joi View Post
    This did the trick indeed! Thank you Paul.

    j.
    Could someone explain why this works. Should the library have set this?

    thanks

  3. #28
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,332
    Quote Originally Posted by bicycleguy View Post
    Could someone explain why this works. Should the library have set this?

    thanks
    Assuming Paul had an idea to know to suggest this and follow-up is coming. Perhaps a change to be made in pin setup in analog read usage so it just works ...

  4. #29
    Junior Member
    Join Date
    Jan 2020
    Location
    on-chip
    Posts
    1
    The modification of analog input pin like INPUT_DISABLE, INPUT_PULLUP, etc. before reading should remain possible, because sometimes it may be useful to read a low impedance signal with a pullup attached, for instance to detect a signal failure caused by a crackling potentiometer or a broken connection, etc., while having the easy option to detach the pullup in software so get the best reading.
    To define a fixed default behavior would waste this feature altogether and require additional circuits or freaky coding in such use cases.

  5. #30
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,332
    Quote Originally Posted by bicycleguy View Post
    Could someone explain why this works. Should the library have set this?

    thanks
    Looking at INPUT_DISABLE it changes the hysteresis handling of the pin. That explains why it was resistant to change mid-value as shown in post #10

    Code:
    		} else { // INPUT_DISABLE
    			*(p->pad) = IOMUXC_PAD_DSE(7) | IOMUXC_PAD_HYS;
    Something about this passed before - perhaps in the beta - Paul knows … how it gets applied will be forthcoming ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •