I didn't do it yet but I was wondering to learn a bit, I want to use a pullup on something of a higher voltage (12v) than the arduino 5v voltage, and set a pin low to bring it to ground I know your not supposed to put more than 5v on an arduino pin so is this a bad idea to do? Common sense says ofcourse I can sink that current, but when im not sinking it it will be at 12v thru a 10k resisitor which is higher than that 5v also if I accidently set that pin high It will sink current still , can that harm anything? I know I can do this properly with a transistor but can this work as is?
but can this work as is?
Simply no. Not even considering the sinking when low and not as much sinking when high outout, every I/O pin has two internal ‘clamping’ diodes, one from the pin to Vcc and one from the pin to ground. Voltages higher then Vcc +.5vdc or more negative then 0 -.5vdc turns on a clamping diode and allows high current to flow until they burn out. They are only rated for something like < 1ma max current, so you see damage in just around the corner if you exceed the voltage ratings of the I/O pins.
Ok thanks, that what I figured but wanted to make sure :D