Skip to content

Instantly share code, notes, and snippets.

@tomaustin700
Last active October 11, 2023 15:01
Show Gist options
  • Save tomaustin700/8b5fc0a816ff45decbf69d60558880cb to your computer and use it in GitHub Desktop.
Save tomaustin700/8b5fc0a816ff45decbf69d60558880cb to your computer and use it in GitHub Desktop.
/*
* For this example, connect your X9C103P (or the like) as follows:
* 1 - INC - Arduino pin 2
* 2 - U/D - Arduino pin 3
* 3 - VH - 5V
* 4 - VSS - GND
* 5 - VW - Output: Arduino pin A0 for analogRead
* 6 - VL - GND
* 7 - CS - Arduino pin 4
* 8 - VCC - 5V
*/
#include <DigiPotX9Cxxx.h>
DigiPot pot(4, 3, 5);
void setup() {
Serial.begin(9600);
}
void loop() {
int potentiometerValue = analogRead(A4);
int percent = map(potentiometerValue, 0, 1023, 0, 100);
pot.set(100);
delay(20);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment