Use ARDUINOs internal current-limiting resistors for LEDs?

adapet200:
That would be done exactly the way it is used to be.

You do still use digitalWrite(PINx, LOW/HIGH); to manipulate the PORT.

Best regards
Adam

In general, this is a bad idea. What happens using this method if pinMode ever gets set to output? Poof goes the smoke.

If you insist on doing this, use the proper methods to guarantee the behavior so the pins never goes low-z.

Turn the LED on using: “pinMode(pin,INPUT_PULLUP);”

Turn the LED off with: “pinMode(pin,INPUT);”

Next, if you really want to win the most obfuscated code award, wrap the above in some #define macros so that the program can change from using internal to external pull-ups by changing defines rather than actual code.

I hope your students will be able to appreciate all the effort you put into this, plus the intentionally teaching of an incorrect way, just so you can save yourself a second or two of effort adding that extra resistor on your breadboard. Because that's what it is, a second or two of effort. And you even have to do that only once, when testing their sketches.