The wiring is currently SCL to 19, SDA to 18, Ground to Ground, Vcc to 3.3V and RW to A0. The Ground is then connected on the breadboard to RL while the Vcc is connected to RH. The code is below. Any help would be appreciated.
Code: Select all
#include <Adafruit_DS3502.h>
Adafruit_DS3502 ds3502 = Adafruit_DS3502();
/* For this example, make the following connections:
* DS3502 RH to 5V
* DS3502 RL to GND
* DS3502 RW to the pin specified by WIPER_VALUE_PIN
*/
#define WIPER_VALUE_PIN A0
void setup() {
//Wire.setSCL(16);
//Wire.setSDA(17);
Serial.begin(115200);
// Wait until serial port is opened
while (!Serial) { delay(1); }
Serial.println("Adafruit DS3502 Test");
if (!ds3502.begin()) {
Serial.println("Couldn't find DS3502 chip");
while (1);
}
Serial.println("Found DS3502 chip");
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
void loop() {
Serial.print("Wiper voltage with wiper set to 0: ");
ds3502.setWiper(0);
float wiper_value = analogRead(WIPER_VALUE_PIN);
wiper_value *= 3.3;
wiper_value /= 1024;
Serial.print(wiper_value);
Serial.println(" V");
Serial.println();
delay(1000);
Serial.print("Wiper voltage with wiper set to 63: ");
ds3502.setWiper(90);
wiper_value = analogRead(WIPER_VALUE_PIN);
wiper_value *= 3.3;
wiper_value /= 1024;
Serial.print(wiper_value);
Serial.println(" V");
Serial.println();
delay(1000);
Serial.print("Wiper voltage with wiper set to 127: ");
ds3502.setWiper(127);
wiper_value = analogRead(WIPER_VALUE_PIN);
wiper_value *= 3.3;
wiper_value /= 1024;
Serial.print(wiper_value);
Serial.println(" V");
Serial.println();
delay(1000);
}