# Internal pull-up resistors

Hi when I code digitalWrite(inputPin, HIGH) is this just assigning a value of 1 to my inputPin or is it actually applying a voltage near 5V to that pin?

Does anyone know where I can find a diagram of this internal resistor?

Thanks

Well, according to the reference material:

If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.

If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins).

I haven't dug through it, but I assume there's specific documentation in the Atmega328 datasheet. If you just want a simplified equivalent circuit drawing, check Grumpy Mike's tutorial.

The value of '1' is meaningless. Maybe you're assuming the 'TRUE' = '1'? But a pin HIGH or LOW is neither TRUE nor FALSE, without any context.

1Bryan: Hi when I code digitalWrite(inputPin, HIGH) is this just assigning a value of 1 to my inputPin or is it actually applying a voltage near 5V to that pin?

Does anyone know where I can find a diagram of this internal resistor?

Thanks

The statement digitalWrite(inputPin, HIGH) without context of what the last mode control was (or if the pin is still at the reset/power-up default input mode). The variable inputPin is just a number and by itself doesn't set the pin mode to either input or output mode, it's just used to address the desired pin.

Anyway, if the pin is in fact in input mode, then the digitalWrite(inputPin, HIGH) statement will enable the internal pull-up resistor so the pin will measure a +5vdc at the pin connection, however it does not have the output current capacity of a output pin, just a 40k or so series resistor wired to +5vdc. If the pins mode was set to output mode prior, then the statement digitalWrite(inputPin, HIGH) will set the output to +5vdc and be able to source current up to the rated maximum value.

Figure 14.2 of the AVR mega328 datasheet (version Rev. 8271D–AVR–05/11) shows the I/O pin configuration and an explanation of how the I/O pins work.

Does that help? Lefty