If the input and output both are connected to a single pin called IO pins, then internal working of the controller is same this, more than one volt meant logic one (1) means Pin is in output mode. and if the voltage is belove 0.5 volt means logic Zero (0) or input mode. here the green led is indicator led which shown in mode is input if it glows, and if not glow means output mode. and red led is indicates the output mode is on or off, these led not only indicates, but they glow by input and output signal come from the IO pin. 4-volt power source for Pin input and 3.3 v source for output and 3.5-volt source for led indication only.