di2tnugraha
Published © CC BY

Arduino Simple Potentiometer

Here's how to use potentiometer with Arduino and LED.

BeginnerFull instructions provided3,933
Arduino Simple Potentiometer

Things used in this project

Story

Read more

Schematics

Arduino Potensiometer

Code

Arduino Potensiometer

Arduino
/*
by: di2tnugraha
https://www.youtube.com/kenziechannel
 */
int led = 11; 
int pinPot = 0; 
int potVal = 0; 
      
void setup() { 
   Serial.begin(9600);  
   pinMode(led, OUTPUT); 
  
}  

void loop() {  
    potVal = analogRead(pinPot); 
    potVal = map(potVal, 0, 1023, 0, 255); 
    analogWrite(led, potVal);
    Serial.println(potVal);
    delay(200);
}  

Credits

di2tnugraha

di2tnugraha

3 projects • 5 followers

Comments