External flashing LED

My first IoT project was to get the on board LED flashing which I achieved here:

Not as easy as IoT

With that accomplished, I now wanted to get an external LED flashing.

I firstly needed to pick a pin on the Adafruit device to control the output on.


I chose the third in from the bottom on the right which is PIN 2.

Next, I needed to work out the maximum output voltage for the Adafruit Feather Huzzah, which turns out to be 3.3 Volts. I also noted the following from the pin output specifications as well:

“be aware the maximum current drawn per pin is 12mA. 6mA recommended”

I also needed to take into account the voltage drop that would occur across the LED, which is around 0.7V. So the voltage for my calculation was now:

3.3V – 0.7V = 2.3V

To work out what resistor I needed to place in the circuit I used the good ole V= IR.


R = V/I

R = 2.3 / 0.006

R = 433 ohms

I double checked my logic at:


I then went through the:

Microsoft Azure IoT Starter Kit w/ Adafruit Feather HUZZAH

I had bought to see what resistors were included. In there I found a 560 ohm resistor. If you need to check your resistor markings like I did, you can use:


to help discern what you have.

A 560 ohm resistor would means my current would be:

I = V / R

I = 2.3 / 560

I = 4.1 milliamps (well below the 6 milliamp recommendation)

All I needed now was to find the ground for the Adafruit


which turned out to be the fourth pin from the top on the left.

I therefore wired up the output from pin 2 on the Adafruit, through the LED, through the resistor and then to ground, completing the circuit.

Now for the code to make it flash.

#include <Arduino.h>

int LED_Pin = 2;

int status = 1;

void setup(){

pinMode(LED_Pin, OUTPUT);


void loop() {

  // put your main code here, to run repeatedly:

if (status) {

digitalWrite(LED_Pin, HIGH);

  } else {

digitalWrite(LED_Pin, LOW);


status = 1-status;

delay (1000);


which is basically the same as before, except the LED_pin now is set to 2. The code is at:


Using PlatformIO IDE I uploaded my code to the Adafruit and after a few minutes was greeted by:


Magic eh?

Sure it’s simple but it’s another step along my IoT journey.

3 thoughts on “External flashing LED

  1. As always, your posts are very useful!

    Even more so today, talking about those equations. I got my ham radio license years ago with those equations. I guess though that I never really understood applying them.

    Mind if I ask you a question?

    My niece has a little gadget that runs a toy motor with 2 AAA batteries. We are trying to eliminate the batteries / run this on AC power.

    I bought a 3V power supply and hooked that up. The motor spins faster than it did with batteries. I’m not sure if that’s because the voltage is higher from the power supply (it’s a low end 3v / 1A brick) rather than the 2 AAAs. My low end digital VOM says it’s putting out 3.5V). Or because it’s able to get more current from that power supply than the batteries?

    Under load, with both the batteries and this power supply, the current and voltage jump all over.

    But anyway, I read up on ‘voltage dividers’ and think of getting a potentiometer to see if I can adjust the speed.

    Yeah, there’s PWM gadgets. But thought a couple resistors / pot would be quicker / simpler and just as good for this toy motor.

    Any thoughts on using resistors to cut the voltage? And / or cut the current?


    1. I would suggest that perhaps the input from the batteries is 1.5V i.e. 2 in parallel, not in series. That would be strange as 3V is typical but that could be the reason why.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s