Now that your RedBoard is set up on its baseplate, the Arduino IDE is installed on your computer and we've written our 'Hello World' example project, we can begin our first Project Set! The First Project Set explores light and the type of electrical component we will be using is a Light Emitting Diode (more commonly known as an LED).

Transcript

Hey guys, it's Christian here from Core Electronics. Today we're going to undertake our first project set, which is involving light using the SparkFun RedBoard. So, the important thing to note about this project is that we're going to be using LEDs. Now an LED is a Light Emitting Diode and the way that it works is it converts electrical potential, into visible light.

So, this is an LED you'll notice that in your guide, it specifies that there are two new concepts that we're going to have to look at in this first circuit;

 So, the first one is that a polarity unlike a resistor an LED possesses polarity, so that means that the longer leg needs to be connected to a higher potential and the shorter leg needs to be connected to a lower potential. This is just because of the way that the diode part of the LED works and it's very important to know because it only lets electricity flow in one way. If you connect it up backwards it could possibly burn out or break the LED.

So, the other thing to note is that the current going through the LED needs to be minimized, now the way that we're going to do that is we're going to use a 330-ohm resistor and that's usually enough to stop it from overheating or once again burning out and breaking.

So very important before we connect anything here, we want to make sure that the Redboard is disconnected from the power, using the USB port now. The reason for this is because we don't want to burn out any components or leave any floating voltages anywhere. So, make sure that it's disconnected and with that said, let's begin making the first circuit.

So, the first circuit uses an LED a resistor and to jumper leads, so we're going to use the LED and we're going to place the long leg in part A2 and the short leg in part A1. Once that's done we'll connect the resistor from E2 to F2 like so. Now I personally like to use the red wires to represent positive 5-volt power or 3.3-volt power if we are using 3.3 and the black R is the black wires to represent ground. So, we'll connect the ground one to E1, making sure that that is indeed the short leg of the LED and will connect the red wire, from J2 to "pin 13". Okay once that's done we can open the Arduino IDE that we installed in the previous tutorial and we'll get to programming.

So, before we program anything now that the connections are made we can connect the USB to the Redboard and initialize if there are any programs previously on it, it will run them. Okay, back to the IDE so we have two functions that we're looking at here that it defaults to, they are the setup function and the loop function. The setup function we use for any sort of code that we only want to run one time and the loop function is what we use to go again and again and again and again. So, in the setup function, we're going to state that we want pin 13 to be an output because we want to output light, so we're going to use the function "pinMode" very similar to how we set up our hello world example in the previous video. So, we're setting the pin 13 to an output, so we specify the pin and then we specify whether it's an import or an output.

Now we're going to go to loop we're going to use the exact same code that we used in a hello world example. We're going to use "digitalWrite" and digitalWrite, we're going to write to pin 13 and going to write a "HIGH". Then we're going to use the delay function, we're going to delay for 2,000 milliseconds or two seconds. Then we'll get our digitalWrite a "LOW" to pin 13 and then we're going to delay it again for the same amount of time. Now it's important to note that we use semicolons (;) at the end of lines to terminate the line and once that's done we will double check that our port and our board are connected to the right one. So, for me it's COM9 and because if you go into your device manager, it'll say that I have something the USB serial port which is this connected to a port 9.

Okay now that's done it'll ask us to save it so we're going to save it as circuit 1A. So it will compile the sketch down here and then once that's done it'll upload it to the board and what we should see is it initializing and then it should flash, on for two seconds off for two seconds, on for two seconds off for two seconds, as long as this power is connected note that if we disconnect this and then reconnect it the program that we've just written will be saved on its own initialize and then it should run again on for two seconds off for two seconds.

That's all there is to it for the first circuit. So, I will catch you guys in the next video, where we'll do circuit 1B.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.