Download Print this page

sparkfun PRT-13144 Hook-Up Manual page 13

Touch potentiometer

Advertisement

uint8_t ReadTpValue() {
  Wire.requestFrom(i2cAddr, 1);
if (Wire.available()) {
return Wire.read();
  } else {
return 0;
  } 
// Read a Touch Potentiometer register
uint8_t ReadTpReg(uint8_t addr) {
  Wire.beginTransmission(i2cAddr+1);
  Wire.write('R');
  Wire.write(addr);
  Wire.endTransmission();
  Wire.requestFrom(i2cAddr+1, 1);
if (Wire.available()) {
return Wire.read();
  } else {
return 0;
  } 
Once that is uploaded, open your favorite Serial Terminal at 115200 baud.
As you slide your finger along the capacitive touch strip ion the Touch Pot,
you should see the current PWM value print out on the terminal.
Multiple Touch Potentiometers
Building on this same example, we can add a second Touch Pot to the I C
bus. You can use the SMD pads found on the back of the Touch Pot to
solder a second Touch Pot to the first.
In order for this to work, you'll need to change the I C address on one of the
Touch Pots. This can be accomplished through the TP Utility app, or it can
be changed on the fly by pressing the button on the back of the Touch Pot
three times.
2
2
Page 13 of 14

Advertisement

loading
Need help?

Need help?

Do you have a question about the PRT-13144 and is the answer not in the manual?

Questions and answers