![]() Before going onto the algorithm part you should have a clear understanding of what is an Arduino UNO and the basic parts. So, start writing the algorithm of our first project subpart. The algorithm is a step-by-step method, which specifies a series of instructions to be executed to get the desired output in a certain order.Īlgorithms are usually generated independently of the underlying languages, i.e. in more than one programming language, an algorithm may be implemented. Multiples Blinking LEDs Algorithmīefore starting to write the algorithm of our project first know what is an algorithm. Let’s start and put some LEDs and Resistors to work. This time, we are going a step further and will try to make Multiple Blinking LEDs in Arduino UNO. Also, in the future if you want to change the LED from pin 8 to pin 11 for example, you can modify this line without touching anything else in the code.In the previous blog, we learned how to connect a single LED to Arduino UNO and make it blink using the code. That way, if you have used different pins than I, you just need to modify those 2 lines. Setup #define LED_PIN 8įirst, as a best practice, we use some defines to keep the pin number for the LED and push button. And when we press the button the LED should be on. What we want to achieve is simple: when the button is not pressed, the LED is off. Turn on the LED when button is pressed, turn it off otherwise Finally, connect a leg of the button (same side as the pull down resistor) to a digital pin (here 7).Īll right your circuit is now finished.Add a red wire between another leg of the button and VCC (5V).This resistor will act as a “pull down” resistor, which means that the default button’s state will be LOW. Connect one leg of the button to the ground, and put a 10k Ohm resistor in between.Add the push button to the breadboard, like in the picture.Add a 220 Ohm resistor in between to limit the current going through the LED. Connect the longer leg of the LED to a digital pin (here pin no 8, you can change it).Plug this shorter leg to the ground (blue line here) of the circuit. You can notice that the LED has a leg shorter than the other. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |