Page 14 - Demo
P. 14


                                     Explanation of Code1. analogRead(potPin); %u2192 Reads potentiometer value between 0%u20131023.2. map(potValue, 0, 1023, 0, 255); %u2192 Converts it into 0%u2013255 range for LED brightness.3. analogWrite(ledPin, ledBrightness); %u2192 Sends PWM signal to control brightness.4. As the potentiometer is rotated:o LED glows dim to bright smoothly. Expected Output / Learning Outcome Rotating the potentiometer changes LED brightness from OFF %u2192 Dim %u2192 Bright. Student learns:%u2022 How to use analog input (analogRead).%u2022 How to scale values using map().%u2022 Using PWM output (analogWrite) to control devices.%u2022 Concept of variable voltage control in real-world systems.
                                
   8   9   10   11   12   13   14   15   16   17   18

 

 

 

 

 

Web hosting by Somee.com