this is hw-477 and hw-480, two different sizes of the redg/green diode. please note this is not an rgb light. it does red green and in between. great for power or battery meter lights. check out our arduino tutorials now!
Affiliate links for arduino sensors! Large Arduino Kit (Recommended) includes various sensors, a couple breadboards, loose components, pcb board, jumper wires, soldering iron AND more: https://www.banggood.com/custlink/mmKhdf9Si8
Want to send me something? Technivorous 902 n Hughes Blunt Sd 57522
All right folks, welcome to Arduino for Beginners. This is Arduino 101.
All right, today I have a couple of red-green diodes. Now this little guy here has both a red
and green light inside it. That yellow color is produced when they both light up at once,
and that's done through the code we're running through our Arduino right now. So in order to
hook this guy up, you have a negative, which is your ground, a green, and a red. They're labeled
GR, and each one controls a light with the negative going back to ground as it should. So
in our case, we're going to wire that negative to the ground on the Arduino directly, then we are
going to wire both the red and the green to our breadboard. Now the red is going into number six
on the Arduino, but first it's passing through a 2.2k ohm resistor. The green can be plugged
directly into the 5 port on the Arduino, but I recommend running that through a 220 ohm resistor.
It does work, as you can see, plugged directly in, and it is a little bit brighter.
Well, it was working. It doesn't seem to want to now. I think that's one of the reasons it's
better off with the resistor. Oh, I grabbed the wrong one. I have these wired backwards by the
way. There we go. So it does work without the resistor. I just prefer to have the resistor
in there. Either way though, let's take a run through the code. Pretty basic. We're going to
grab two pins we're going to define, and these are six and five, because that's what we have it
plugged into. And we are going to set those pin modes to output, so we can send high and low and
turn the lights on and off. And then we are going to go into our void loop, which is going to have
a series of digital writes. This one turns the red on and the green off.
This one turns the red off and the green on, and then this one turns them both on.
And that is so because in the previous iteration, green was already on, so it continues to stay on.
And then it turns off in the next one. So the loop just falls through itself,
rotating through the three colors. You can take out this one here, and it'll just blink between
red and green, and I can show you that real quick.
Just upload real quick, and there we go. Red and green on and off. So what this is good for is to
use as like a power indicator for whether or not a device is turned on or turned off. If the device
is plugged in or has a stable power source, the red LED uses very, very little amount of energy,
so it can stay on without drawing the battery too much. So this is a pretty simple setup.
There are several other ways you can do this and several other things you can do with this.
In fact, if I wanted to just skip and let's try doing this. Let's see here. I'm going to comment
this out real quick, and I'm going to copy this. Then I'm going to copy this and change these to
low, and what we should get is a flashing warning yellow indicator light.
So let's try that real quick. What am I doing? Just lolling around over here. There we go. So
we'll push real quick, and let's see if we get that blinking yellow. There it is. Hazard light,
low battery warning, something like that. So tons of applications for this. Definitely recommend you
pick some of these up. You can buy them in bulk, but you can also buy them in kits with the other
sensors, and you can also get a giant Arduino pack for everything that has a couple of boards
and some breadboards, some circuits, stuff like that. Not circuits, PCB boards you can make your
own circuits with and things like that. So you'll find those links down below. That's going to be
it for this video. Let's move on to the next sensor. Well, that's it guys. That's going to
wrap up this video. If you've noticed a shirt, the merch is available. Go ahead and check out
the Teespring merch link down below. It won't be available on a channel store until I reach 10,000
subscribers, and so far I am just about to hit 5,000. So it'll be a little while, a couple more
months before you see this on the actual channel, but they are available now. I have a couple other
designs. Feel free to pop over there and check them out, and know that any purchase through the
Teespring site definitely helps to promote our site here and increase the channel's ability to
make videos in the future. So we appreciate all your support. Don't forget to check out
the Teespring link. Check out our Patreon link. Leave a like on this video and hit that subscribe
button because we have a lot more coming at you in the coming days.