How to disable a pin?

Status
Not open for further replies.

potatotron

Well-known member
I'd like to keep track of the coin cell powering the Teensy 3.0 RTC. I can do this by connecting the battery's positive terminal to an analog pin and measuring with analogRead(), but I don't need to check it very often (once a day?).

The default state of a Teensy 3.0 pin is disabled so I have to explicitly set it to INPUT or OUTPUT to use it. Is there a way to re-disable it after taking a reading? If I can do that I think I will minimize battery power loss.
 
You'll need to write directly to the pin's config register. Just set it to zero to disable the pin.

Teensyduino has convenient names for each one based on the pin number. So for example, if you connect the signal to pin 14 (analog channel 0), you'd use this:

Code:
  CORE_PIN14_CONFIG = 0;
 
i was wondering if you would also have to connect the ground pin of the battery to AGND?
 
You'll need to write directly to the pin's config register. Just set it to zero to disable the pin.

Teensyduino has convenient names for each one based on the pin number. So for example, if you connect the signal to pin 14 (analog channel 0), you'd use this:

Code:
  CORE_PIN14_CONFIG = 0;

Thank you, I will try this out.
 
Status
Not open for further replies.
Back
Top