|
@@ -19,16 +19,24 @@ byte potAdress[4][2] = { {AD_adress1, AD_pot1},
|
|
|
|
|
|
void setup_AD5242() {
|
|
|
Wire.begin(); // join i2c bus (address optional for master)
|
|
|
- Serial.println("starting digipots");
|
|
|
- Serial.println(AD_adress1);
|
|
|
- Serial.println(AD_pot1);
|
|
|
- Serial.println(potAdress[0][0]);
|
|
|
- for (int i ; i<4 ; i++) {
|
|
|
- for (int j ; j<2 ; j++){
|
|
|
- Serial.print (potAdress[i][j], HEX);
|
|
|
- Serial.print ("-");
|
|
|
+ Serial.println("starting potentiometers");
|
|
|
+// Serial.println(AD_adress1);
|
|
|
+// Serial.println(AD_pot1);
|
|
|
+// Serial.println(potAdress[0][0]);
|
|
|
+// for (int i ; i<4 ; i++) {
|
|
|
+// for (int j ; j<2 ; j++){
|
|
|
+// Serial.print (potAdress[i][j], HEX);
|
|
|
+// Serial.print ("-");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//Set potentiometers to 0
|
|
|
+ for (int pot ; pot<4 ; pot++){
|
|
|
+ Wire.beginTransmission(potAdress[pot][0]);
|
|
|
+ Wire.write(potAdress[pot][1]);
|
|
|
+ Wire.write(potValue[pot]);
|
|
|
+ Wire.endTransmission();
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void handle_AD5242() {
|
|
@@ -43,7 +51,7 @@ void handle_AD5242() {
|
|
|
Wire.write(potAdress[pot][1]);
|
|
|
Wire.write(potValue[pot]);
|
|
|
Wire.endTransmission();
|
|
|
- Serial.println("updated");
|
|
|
+ //Serial.println("updated");
|
|
|
|
|
|
}
|
|
|
}
|