Hi
My new touch sensor doesn't work. Because I'm new to arduino I don't know if it is a software or hardware problem.
I use the i2cdev and the mpr121 libraries (see attached sketch). During the init I'm testing the connection with touch.testConnection - but it always returns false.
After that I'm reading back other previous set register but I'm always getting a 0x00 although they were set to different values.
The touch board is connected on one of the two i2c connectors of a Grove-Base Shield v1.2 (I've tried both of the connectors).
For me the sketch looks correct, now I'm not sure if it's a hw problem?
Thanks for your help.
Roger
I2C Touch Sensor V1.1 doesn't work
Moderators: lily.li, violet, salmanfarisvp, jeremy882, crail.lyu969
-
- Pre-kindergarten
- Posts: 2
- Joined: Sun Jan 13, 2013 5:37 pm
- Jacket Chen
- Staff
- Posts: 659
- Joined: Thu Jun 21, 2012 4:25 pm
- Are you a staff member of seeedstudio?: yes
- Which products/projects are your favorite?: Seeeduino Shields
- Location: China
Re: I2C Touch Sensor V1.1 doesn't work
Hey , i'm sorry that i have not seen your attachment~~~could you post it again
Love little, love long.
-
- Pre-kindergarten
- Posts: 2
- Joined: Sun Jan 13, 2013 5:37 pm
Re: I2C Touch Sensor V1.1 doesn't work
Hi jacket
You are right! I can't upload the code because after hitting "Add the file" it get an error message "The extension ino is not allowed."?!
So I paste the code here... The output of the code is always "MPR00000".
// ********************** CODE BEGIN ******************************************
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"
// SLCD
#include <SerialLCD.h>
#if ARDUINO < 100
#include <NewSoftSerial.h> //this is a must
#else
#include <SoftwareSerial.h>
#endif
// Touch Sensor
#include "I2Cdev.h"
#include "MPR121.h"
// Init LCD
SerialLCD slcd(11,12);//this is a must, assign soft serial pins
// Init Touch
MPR121 touch(0x5A);
uint8_t buffer = 0;
void setup() {
// set up
slcd.begin();
Serial.begin(9600);
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin(0x5A);
touch.initialize();
slcd.print("MPR");
slcd.print(touch.testConnection(),DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 4, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 5, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 6, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 7, &buffer);
slcd.print(buffer,DEC);
}
void loop() {
}
// ********************** CODE BEGIN ******************************************
Thanks for your help!
Roger
You are right! I can't upload the code because after hitting "Add the file" it get an error message "The extension ino is not allowed."?!
So I paste the code here... The output of the code is always "MPR00000".
// ********************** CODE BEGIN ******************************************
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"
// SLCD
#include <SerialLCD.h>
#if ARDUINO < 100
#include <NewSoftSerial.h> //this is a must
#else
#include <SoftwareSerial.h>
#endif
// Touch Sensor
#include "I2Cdev.h"
#include "MPR121.h"
// Init LCD
SerialLCD slcd(11,12);//this is a must, assign soft serial pins
// Init Touch
MPR121 touch(0x5A);
uint8_t buffer = 0;
void setup() {
// set up
slcd.begin();
Serial.begin(9600);
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin(0x5A);
touch.initialize();
slcd.print("MPR");
slcd.print(touch.testConnection(),DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 4, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 5, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 6, &buffer);
slcd.print(buffer,DEC);
buffer = 0;
I2Cdev::readByte(0x5A, 7, &buffer);
slcd.print(buffer,DEC);
}
void loop() {
}
// ********************** CODE BEGIN ******************************************
Thanks for your help!
Roger
- Jacket Chen
- Staff
- Posts: 659
- Joined: Thu Jun 21, 2012 4:25 pm
- Are you a staff member of seeedstudio?: yes
- Which products/projects are your favorite?: Seeeduino Shields
- Location: China
Re: I2C Touch Sensor V1.1 doesn't work
hi,are you sure this code you posted could compile right? i could not compile it ,and with many errors.
Love little, love long.