In this part of the Arduino programming course, we look at another kind of loop called the "for" loop. Whereas statements or code in the Arduino main loop will run continually and never exit the loop, the for loop allows us to loop through code a certain number of times before exiting the loop.
1st Class: • C-1: Basic Concept of Arduino Programming ...
2nd Class: • C-2: Arduino LED Blink (use single & multi...
3rd Class: • C-3: Digital & Analog Signal Input | Ardui...
4th Class: • C-4: Conditional Statement in Arduino Prog...
5th Class Quiz Link: https://forms.gle/CnEf1t6F5RHnV8jV8
How to Control the Brightness of a LED
Step 1: Putting Potentiometer in Place. -Take the red and black wire from the battery connector and put them on the side rails. ...
Step 2: Putting Resistors in Place. -Put 1k resistor in the middle lead of the potentiometer and put the other end in a different rail. ...
Step 3: Wiring. ...
Step 4: Finished Product.
Controlling Brightness of LED through Code
Connect the positive leg of LED which is the longer leg to the digital pin 6 of Arduino. Then connect the 220 ohm resistor to the negative leg of LED and connect the other end of resistor to the ground pin of Arduino.
How it Controls the Light Intensity Automatically: As per the circuit diagram, we have made a voltage divider circuit using LDR and 100k resistor. The voltage divider output is feed to the analog pin of the Arduino. The analog Pin senses the voltage and gives some analog value to Arduino
PWM provides the ability to 'simulate' varying levels of power by oscillating the output from the microcontroller. If, over a short duration of time, we turn the LED on for 50% and off for 50%, the LED will appear half as bright since the total light output over the time duration is only half as much as 100% on.