Qtouch 1 wire library with multiple Qt chips

Hello,

I am currently working on a prototype that has two QT1103 chips on it. Each chip has 10 capacitive touch sensors. I am using the QTouch1Wire library of Dave Vondle.

The library is working perfect for one chip, but I am unable to readout both chips at the same time or one by one.

Is this something someone already figured out or does someone has an idea? For now I am using the simple polling example:

/*
 Qtouch QT1103 1-wire serial example
 
 polls and prints the status of the capacitive pads.
 
 if you have the E1103 evaluation board, the pads are layed out in the 2x5 grid like:
 96574
 81203
 
 Created 23 November 2009
 By Dave Vondle
 
 */
#include <Qtouch1wire.h>

#define ONEWIREPIN 3

unsigned int value;

void setup() {

  OneWire.begin(ONEWIREPIN, 9600); // should be > 8000 according to datasheet
  Serial.begin(19200);
}

void loop() {
  delay(100);

  value = OneWire.requestRead();

  if(value>>8 & B00000001){
    Serial.print("0");
  }
  else{
    Serial.print(" ");
  }
  if(value>>8 & B00000010){
    Serial.print("1");
  }
  else{
    Serial.print(" ");
  }
  if(value>>8 & B00000100){
    Serial.print("2");
  }
  else{
    Serial.print(" ");
  }
  if(value>>8 & B00001000){
    Serial.print("3");
  }
  else{
    Serial.print(" ");
  }
  if(value>>8 & B00010000){
    Serial.print("4");
  }
  else{
    Serial.print(" ");
  }
  if(value>>8 & B00100000){
    Serial.print("5");
  }
  else{
    Serial.print(" ");
  }
  if(value & B00000001){
    Serial.print("6");
  }
  else{
    Serial.print(" ");
  }
  if(value & B00000010){
    Serial.print("7");
  }
  else{
    Serial.print(" ");
  }
  if(value & B00000100){
    Serial.print("8");
  }
  else{
    Serial.print(" ");
  }
  if(value & B00001000){
    Serial.print("9");
  }
  else{
    Serial.print(" ");
  }
  if(value & B00010000){
    Serial.print("10");
  }
  else{
    Serial.print(" ");
  }

  Serial.print("      ");
  Serial.println(value, BIN);  

}

Thanx!

I figured it out myself. For those who want to know:

Add Qtouch1wire OneWire2 = Qtouch1wire(); to the .ccp library file and add extern Qtouch1wire OneWire2; to the .h library file.

#include <Qtouch1wire.h>

#define ONEWIREPIN 5
#define ONEWIREPIN2 6

unsigned int value;
unsigned int value2;
void setup() {
   OneWire.begin(ONEWIREPIN, 9600); // should be > 8000 according to datasheet
  OneWire2.begin(ONEWIREPIN2, 9600); // should be > 8000 according to datasheet
  Serial.begin(19200);
}

void loop() {
  delay(10);

  value = OneWire.requestRead();
value2 = OneWire2.requestRead();

Serial.print(value,BIN);
Serial.print("      ");
Serial.println(value2,BIN);
 }