This part is intended for absolute beginners in .NET Micro Framework. We are going to write a really simple application, which will light the LED while a button is pressed. We will use the Tahoe board as a hardware platform, but the steps are the same for other hardware, as well as for emulator.
You cannot connect common LED directly to the processor, as it is capable of delivering only specified amount of current. To avoid damaging the processor, we have to limit the current using a resistor. You have two options: either compute the required resistor value and connect it with diode in series, or get a diode with a built-in resistor.
How to find out the required resistore value? You need to know three things:
The requested resistor value is then computed as (Upin – Uf) / Isrc, in our case (3.3 V – 2 V) / 0.004 A = 325 Ω.
The other option is to not search nor compute anything, put e.g. 5 kΩ there just for sure. The only thing which can happen is that the LED won't shine very much.
The last problem is how to wire the diode. For example, Tahoe has all pins accessible through 0.1" male connectors:
You can create some wires yourself of course, or solder the female parts directly to the diode. But if you have a free IDE or floppy cable, you can connect it directly to the Tahoe! The pin-out is kept the same, but this time on a connector into which you can easily insert wires. In this case however, when all we need is to connect two wires, some cables from inside of PC could be enough, like those from motherboards (to buttons, fans, or LEDs) or like betwen sound card and CD drive (be it analogue or digital one).
The GPIO1 pin which we choosed in the application is (not exactly by chance) placed just directly opposite the ground (0V). You can also test the diode before by placing it between 0V and 3.3V, which are also just on the next pin to the GPIO1. Cathode is called the part of diode which belongs to the ground. You can recognize it either by shorter wire, or by flat lighting part on that side. In either case, the diode will just not work if connected badly.
LED with sockets directly on Tahoe.Notice the flat side connected to 0V.
These LEDs have built-in resistor,don't connect them directly without it!
LED connected using the IDE cable.