Potentiometer – 10k

$2.75

66 in stock

Description

Potentiometer Code


/* SETUP
    * ----
 *     *  |-- 1
*  pot  * |-- 2
 *     *  |-- 3
    *-----

Potentiometer     Arduino
1        -        3.3V
2        -        GND
3        -        D2
*/
 
int potPin = 2;    // select the input pin for the potentiometer
int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the value coming from the sensor

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  val = analogRead(potPin);    // read the value from the sensor
  digitalWrite(ledPin, HIGH);  // turn the ledPin on
  delay(val);                  // stop the program for some time
  digitalWrite(ledPin, LOW);   // turn the ledPin off
  delay(val);                  // stop the program for some time
}

 

Additional information

Weight 0.007 kg

There are no reviews yet.

Be the first to review “Potentiometer – 10k”

Your email address will not be published. Required fields are marked *