Drastically low current on all boards

The weirdest thing is happening with my Arduinos right now (UNO, Mega, Nano; both original and clones). A couple of things didn’t work, so I tried to go back to the basics: just getting an LED to light up (with a 220 Ohm resistor). The LED works fine at the 5V port on all Arduinos, and draws around 11mA. But when I set any digital pin high (digitalWrite(pinNumber, HIGH)) and hook the LED up to that pin, it barely lights up, and only draws around 0.1 mA.

I tried it with a number of different board types (always compiling it for the right type, I think), with both originals and clones, hooked up to two different PCs, and there’s always the same behavior.

Now here’s the weirdest thing: I wanted to try it out on an UNO, but forgot to upload the sketch before connecting it. That board still had a sketch running, which was putting that digital pin HIGH. I connected the LED to that digital pin and it lighted up perfectly! So I figured that all other boards must be broken, which would be unlikely, but not impossible. However, I then uploaded my new sketch, and the same board with the same LED at the same pin didn’t work properly anymore! It just barely lights up and only draws around 0.1mA.

This is the sketch I’m working with:

void setup() {
  digitalWrite(4, HIGH);

void loop() {
  // put your main code here, to run repeatedly:


The wiring is trivial as well: D4 -> LED -> 220 Ohm -> GND. Again, this works perfectly fine when connecting it to 5V, instead of D4.

Does anyone have a clue why that might be? For some clones, I had to install an additional driver. Could that have an influence?

You're using the pull-up resistor as a current limiter. Use pinMode (4, OUTPUT) first.

AWOL: You're using the pull-up resistor as a current limiter. Use pinMode (4, OUTPUT) first.

I just realized this the minute I posted my question :D. Such a stupid mistake! Thank you very much for your reply ;-)