I am trying to send two byte of data stored as a string to a dual channel potentiometer using I2C. I get an error message that says, "no matching function for call to 'TwoWire::write(String&)' and highlights the second Wire.write function at the very end of my program.
//10EF01FE = VOL+
//10EF718E = VOL-
//10EFC13E = CH+(VOL +10)
//10EF619E = CH-(VOL -10)
//10EF3BC4 = EXIT(MUTE)
#include <IRremote.h>
#include <Wire.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
int dpVdd = 12;
int potZero;
int potOne;
String zeroString = String(potZero, BIN);
String oneString = String(potOne, BIN);
const byte ds1882 = B01011110;
void setup()
{
Serial.begin(9600);
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
delay(500);// to power Vdd on digital pot after Vcc/V-
digitalWrite(dpVdd, HIGH);
potZero = 53;
potOne = potZero+64;
Serial.println(potZero, potOne);
Wire.begin();
Wire.beginTransmission(ds1882);
Wire.write(zeroString);
Wire.write(oneString);
Wire.endTransmission();
//SPI.begin();
//pinMode(csPin, OUTPUT);
//digitalWrite(csPin, LOW);
//SPI.transfer(LR);
//SPI.transfer(vol);
//digitalWrite(csPin, HIGH);
}
void loop() {
if (irrecv.decode(&results))
{
//Serial.println(results.value, HEX);
if (results.value==0x10EF01FE) //VOL+
{
--potZero;//decreases attenuation not volume
--potOne;//decreases attenuation not volume
}
else if (results.value==0x10EF718E) //VOL-
{
++potZero;//increases attenuation not volume
++potOne;//increases attenuation not volume
}
else if (results.value==0x10EFC13E) //VOL+10
{
potZero -= 10;//decreases attenuation not volume
potOne -= 10;//decreases attenuation not volume
}
else if (results.value==0x10EF619E) //VOL-10
{
potZero += 10;//increases attenuation not volume
potOne += 10;//increases attenuation not volume
}
else if (results.value==0x10EF3BC4) //MUTE
{
potZero = 63;//max attenuation
potOne = 63;//max attenuation
}
potZero = constrain(potZero, 0, 63);
potOne = constrain(potOne, 0, 63);
Serial.println(potZero, potOne);
irrecv.resume(); // Receive the next value
}
Wire.begin();
Wire.beginTransmission(ds1882);
Wire.write(zeroString);//writes binary string to pot0
Wire.write(oneString);//writes binary string to pot1 - error message highlights this line
Wire.endTransmission();
//digitalWrite(csPin, LOW);
//SPI.transfer(LR);
//SPI.transfer(vol);
//digitalWrite(csPin, HIGH);
delay(100);
}
All other examples I've seen of other people doing multiple byte sends shows to do it the way I did. Where did I go wrong?