Image

The 2N7002 (surface-mount SOT23 package) or 2N7000 (breadboard-friendly TO-92 package) used in this example is a common and inexpensive N-Channel MOSFET that serve as good general-purpose device. They can easily be found online or in any self-respecting electronics store.And that’s it. Your code will be exactly the same as if you had the LED hooked up directly to the GPIO Pin — you set the GPIO pin to output with IODIR, using IOSET and IOCLR to turn the LED on or off) — but you now have a much safer way to work with high current devices without any risk of damaging your MCU!

Advertisements