Hi everyone, I'm new to Arduino, I was reading the documentation when I came accross this:
"The pullup resistors are controlled by the same registers (internal chip memory locations) that control whether a pin is HIGH or LOW. Consequently, a pin that is configured to have pullup resistors turned on when the pin is an INPUT, will have the pin configured as HIGH if the pin is then switched to an OUTPUT with pinMode(). [u]This works in the other direction as well, and an output pin that is left in a HIGH state will have the pullup resistors set if switched to an input with pinMode()[/u]."
[u]Part1:[/u] I tried to switch from INPUT_PULLUP to OUTPUT :
pinMode(8, INPUT_PULLUP); delay(1000); pinMode(8, OUTPUT); delay(1000);
When I connect a diode to pin 8, it goes from being dim (INPUT_PULLUP), to beign bright(OUTPUT) as expected.
[u]Part2:[/u] But when I try to switch from OUTPUT HIGH to INPUT it doen't work:
pinMode(8, OUTPUT); digitalWrite(8, HIGH); delay(1000); pinMode(8, INPUT); delay(1000);
It should go from bright to dim, but it doesn't. It goes from bright to OFF. Is it a mistake in the documentation, or I understood it wrong ? :confused:
Thanks for your help.