I met up with Brian and Dmitry for a few drinks the other
day and they tell me that they completed a tutorial on how to turn on an LED by
adding code to Arduino. Apparently it took them three hours. Now I've seen the
tutorial and it looked incredibly simple. So, naturally, I scoffed in their
faces and told them how bad they were at life. In turn, they decided to
challenge me to do it too and they even
gave me a week. *Scoff again* "pffft, I'll do it in two days as long as
you promise to give me all of the equipment I need". With mischievous
smiles on their faces, they agree.
The next day comes around and I pick up the box with all of
the wires, LEDs, Arduino, a multimeter, and some other miscellaneous items. I
start early in the morning by first installing the Arduino IDE and pulling up
the tutorial I need. Ok, not even 10 steps long. No big deal. 15 minutes go by
and I've connected a 220ohm resistor to the D13 pin then the LED and then back
into Arduino through the ground. Awesome, I have a complete circuit. Now to the
code: simple copy & paste into the IDE, verify, and upload.
As expected by their smiles (and the fact that it took them
a while to complete), it didn’t work. That’s fine; this isn’t my first time debugging
something. Considering my main strength (programming), I figured I should look
through the code first and make sure everything looks right. Yep, everything
seems fine in the code. Not much that could go wrong in 20 lines.
A little bit out of my comfort zone already, I start looking
through the hardware. I grab the multimeter and start checking voltages. Before
the resistor, every second it alternates the output from 0V to 5V. After the
resistor, it goes down a little bit which is also to be expected. Then after
the LED it goes down to 1.5V and 0V.
The fact that Arduino is alternating between 5V and 0V shows
that the code is working. And there is current all the way from D13 to ground
so all of the connections are touching. Maybe a broken LED? Can they even break
and still keep the connection intact? Doesn’t matter, I replace the LED with a
new one. Still not working.
After an hour and a half of building, rebuilding, and
questioning any assumptions I’ve made I decide to look around online and do
some more research. I start with Arduino: look up D13, maybe it has some
special property that doesn’t work? That wasn’t it. Read some more about the
actual board, maybe I need some enable pin or something. No. Two hours in and
I’m starting to panic because my goal of finishing before they both completed
is coming up (yes, I have to one-up them).
Then I look up the resistor, maybe it’s on the wrong way?
Apparently that’s not possible. Although, I would be lying to say that I didn’t
try it out anyway. How about the LED? I look up the part number on Adafruit .
Then I notice the title is “Super-bright 5mm IR LED (25 pack)”. IR = Infra-Red.
It doesn’t matter how bright these “Super-bright” LEDs are: I CANNOT SEE INFRA-RED.
I rush to grab my phone camera (because it can see that section of the
spectrum) and low and behold, there it is lighting up every second.
Victory. 2.5 hours later. Ugh the frustrations: who the hell
gets IR LEDS anyway?
No comments:
Post a Comment