WARNING: This video assumes a basic knowledge of Arduino programming and it is not for the faint-hearted. I am providing it to give interested viewers some insight into the workings of the LED class. If you do not care about the nuts and bolts, you can skip this video entirely and simply use the LED class. I will demonstrate one application of the LED class in an upcoming video on grade crossing flashers.
LED terminology: An LED has two connections: the anode and the cathode. Current flows through an LED in just one direction: from the anode to the cathode. The anode is always connected to positive voltage and the cathode is always connected to the ground. The longer lead of an LED is almost always the anode. If there is a small plastic flange at the base of the LED, the flange is flattened on the cathode side.
The Arduino turns LEDs on and off by controlling the voltage applied to the LED leads. An LED is turned on by applying +5 volts to the anode and zero volts (or ground) to the cathode. An LED may be turned off in either of two ways: (1) by applying zero volts to both the anode and the cathode, and (2) by applying +5 volts to both the anode and the cathode. In both of these, there is no net voltage across the LED and current cannot flow. (Note that applying zero volts to the anode and +5 volts to the cathode will not result in current flow: the LED - which is a Light Emitting DIODE - will not allow reverse current flow.)
When LEDs are connected in parallel (as for example, in multicolor LEDs), they may be connected as “common anode” or as “common cathode.” A common anode connection supplies positive voltage to all LEDs at once, and the individual LEDs are switched on and off by controlling the connection to ground. A common cathode connection connects all LEDs to ground, and LEDs are switched on and off by controlling the positive voltage supply.
-----------------------------------------------------------------------------------------------------------------------
Links to items mentioned in this video. (Note: I am NOT endorsing any particular product(s), nor am I compensated by or connected to any of the companies mentioned.) I do NOT guarantee that these links will give you the best available price! Consider these links to be a starting point for your search.
Source code listings: github.com/RJW... There are four files of interest: Classes_1.ino, Classes_2.ino, Classes_3.ino, and Classes_4.ino. The .ino extension means these files were created by the Arduino IDE, but they are simple text files and may be opened by any text editor.
Arduino Nano Clone: www.amazon.com...
Prototyping Circuit Board: www.amazon.com...
Jumper wires: www.amazon.com...
LEDs: www.amazon.com...
120 Ohm resistors: www.amazon.com...
Arduino IDE Download: www.arduino.cc...
The most recent version (as of the release date of this video) is 2.1.0. In this video, I am using version 1.8.13. You can download legacy versions of the IDE by scrolling down the page.
-----------------------------------------------------------------------------------------------------------------------
This video was edited using Shotcut for Linux. Video footage and still images were recorded using a Galaxy A10e phone and a Nikon D7100 camera.
26 авг 2024