pinThreeStateMode()
[Digital I/O]
void pinThreeStateMode(unsigned short pin, unsigned short mode);Description
Configures the impedance mode of the specified three-state pin.
It only works with pins that have been defined as three-state pins
with pinMode().
Parameters
pin: the Custom Element pin.
mode: HIGH_IMPEDANCE, HIGH_Z
or LOW_IMPEDANCE, LOW_Z
Returns
Nothing.
Example Code
The code sets the digital pin 7 as a three-state pin toggle the
impedance state between HIGH_Z and LOW_Z.
void setup() {
pinLabel(7, "OUT"); // sets the pin 7 label to "OUT"
pinMode(7, THREE_STATE); // sets the digital pin 7 as THREE_STATE output
}
void loop() {
// Remember that the pin is a THREE_STATE output,
// so the High Z state will disconnect the pin from the circuit
digitalWrite(7, HIGH); // sets the digital pin 7 to HIGH
pinThreeStateMode(7, HIGH_IMPEDANCE); // sets the digital pin 7 to HIGH_IMPEDANCE
delay(1000); // waits for a second
pinThreeStateMode(7, LOW_IMPEDANCE); // sets the digital pin 7 to LOW_IMPEDANCE
delay(1000); // waits for a second
}Notes and Warnings
All the pins can be used as three-state pins, except for the power and ground pins. By default, all pins are set as input pins (High Z Mode).
