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.

Thanks
Bu

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. http://www.atmel.ca/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet.pdf

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