Can I programmatically access the current infromation on a PIN?

HI folks,

I was wondering if it is possible to programmatically access the current information on an Arduino PIN? For example, say I have assigned HIGH to an OUTPUT pin and on the board the connected that pin and ground to a resister of 1kOhms, can I access a variable/register variable in the program which will give me 5mA.


Not really. The closest I think you can get is to read the PINx register to see if it is drawing enough current to pull it to 0 (low). Based on the port sink abilities specified in the datasheet you could calculate what the minimum current draw is to pull it down from high.

You could use a resistor and measure the voltage drop of the resistor with two analog inputs.