Ardunino Uno Project 2 - Spaceship Interface

Hi neighborinos,

Brought myself an arduino and have a question about the operation of the microcontroller itself from when I was working on the Spaceship Interface Project in the starter manual for the Ardunion Uno.

The program that performs the function checks whether a voltage is registered on pin 2. When its low the green LED is illuminated. When the button is pushed the switch is closed and pin 2 registers a voltage causing the red LED's to cycle on and off.

My question is this. When no voltage is registered on pin 2. How is the green LED powered? Is the digital pin rack connected to the power source which enables the pin 3 to supply an output voltage and illuminate the green LED?

Many thanks

The voltage on an Arduino pin has nothing to do with the power for the Arduino - power comes from the USB cable or the barrel-jack.

When a pin is set for INPUT it can read the voltage on the pin but it does not take any appreciable current into the pin.

When a pin is set for OUTPUT it can provide a small amount of current (about 20 mA and 40mA absolute max) which is sufficient to light an LED (assuming a suitable resistor on the LED). That 20mA comes from the USB connection.

...R