--- /dev/null
+#include <SPI.h>
+
+#define INPUT_PIN A0
+
+#define WRITE_CMD 0x00
+#define INCR_CMD 0x01
+#define DECR_CMD 0x02
+#define READ_CMD 0x03
+
+#define WIPER0_ADDR 0x00
+#define WIPER1_ADDR 0x01
+
+#define ADDR_OFFSET 12U
+#define CMD_OFFSET 10U
+
+#define POT_MIN 0U
+#define POT_MAX 256U
+
+void setup()
+{
+ pinMode(INPUT_PIN, INPUT);
+ SPI.begin();
+}
+
+void loop()
+{
+ SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
+ SPI.transfer16(
+ WRITE_CMD << CMD_OFFSET |
+ WIPER0_ADDR << ADDR_OFFSET |
+ map(analogRead(INPUT_PIN), 0, 1023, 0, 256));
+ SPI.endTransaction();
+ delay(5);
+}