All submissions

LED Brightness Control Using Potentiometer

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/


#define LED_PIN 3

int pot_value    = 0;
int mapped_value = 0;

void setup() 
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(LED_PIN,OUTPUT);
}

void loop() 
{
  
  pot_value = analogRead(A0);

  mapped_value = map(pot_value,0,1023,0,255);

  analogWrite(LED_PIN,mapped_value);

  delay(50);
}

 

Output

Video

Add video of output (know more)

 

https://youtube.com/shorts/2u01cHqKr0Q?feature=share

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!