MPR121 Touch Sensor Breakout Demo Error
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- yishi
- Posts: 16
- Joined: Fri Jan 31, 2014 12:10 am
MPR121 Touch Sensor Breakout Demo Error
Hi,
I'm trying to use this sensor with Arduino Due but got stuck at the first step.
I got an error when compiling:
MPR121test.ino: In function 'void loop()':
MPR121test.ino:52:29: error: '_BV' was not declared in this scope
MPR121test.ino:56:30: error: '_BV' was not declared in this scope
Error compiling.
Please help!
I'm trying to use this sensor with Arduino Due but got stuck at the first step.
I got an error when compiling:
MPR121test.ino: In function 'void loop()':
MPR121test.ino:52:29: error: '_BV' was not declared in this scope
MPR121test.ino:56:30: error: '_BV' was not declared in this scope
Error compiling.
Please help!
- adafruit_support_mike
- Posts: 68400
- Joined: Thu Feb 11, 2010 2:51 pm
Re: MPR121 Touch Sensor Breakout Demo Error
That looks like a platform error.
The Due uses a different microcontroller than the rest of the Arduino family, so it takes some massaging to get code written for the Uno to compile for a Due.
IIRC, that error has something to do with the Wire library, which handles I2C. Let me check with our Due expert to see if he knows more about that library.
The Due uses a different microcontroller than the rest of the Arduino family, so it takes some massaging to get code written for the Uno to compile for a Due.
IIRC, that error has something to do with the Wire library, which handles I2C. Let me check with our Due expert to see if he knows more about that library.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MPR121 Touch Sensor Breakout Demo Error
_BV is a macro in the AVR library. It doesn't exist in the ARM library, so you have to provide it. Add the following to your sketch, right after the #includes:
Code: Select all
#ifndef _BV
#define _BV(bit) (1<<(bit))
#endif
- yishi
- Posts: 16
- Joined: Fri Jan 31, 2014 12:10 am
Re: MPR121 Touch Sensor Breakout Demo Error
Thanks guys!
Now I'm able to run the sketch.
However, the Serial shows another error:
Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?
I think my wiring is correct.
SCL to 21(SCL) on Due
SDA to 20(SDA) on Due
Vin to 5V on Due
GND to GND on Due
Now I'm able to run the sketch.
However, the Serial shows another error:
Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?
I think my wiring is correct.
SCL to 21(SCL) on Due
SDA to 20(SDA) on Due
Vin to 5V on Due
GND to GND on Due
- yishi
- Posts: 16
- Joined: Fri Jan 31, 2014 12:10 am
Re: MPR121 Touch Sensor Breakout Demo Error
I need to use this chip with Arduino Due.
But I just tried it with Leonardo got some other issues.
The program seems to be stuck at !cap.begin(0x5A)
The Serial only says "Adafruit MPR121 Capacitive Touch sensor test" and not even "MPR121 not found, check wiring?"
I have no idea what's going on...
But I just tried it with Leonardo got some other issues.
The program seems to be stuck at !cap.begin(0x5A)
The Serial only says "Adafruit MPR121 Capacitive Touch sensor test" and not even "MPR121 not found, check wiring?"
I have no idea what's going on...
- yishi
- Posts: 16
- Joined: Fri Jan 31, 2014 12:10 am
Re: MPR121 Touch Sensor Breakout Demo Error
Now the chip works with Leonardo finally. I think it was caused by bad soldering.
But it still doens't work with Due, it keeping saying can't find the chip.
But it still doens't work with Due, it keeping saying can't find the chip.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MPR121 Touch Sensor Breakout Demo Error
I don't know what to tell you. There's nothing about the Due that would make it not work. If it works with a Leonardo, it should work with a Due.
- yishi
- Posts: 16
- Joined: Fri Jan 31, 2014 12:10 am
Re: MPR121 Touch Sensor Breakout Demo Error
Hi Rick,
I tried with two different Due and it still can't find MPR121.
Is there any issues with Due's I2C communication you know of?
I found this post http://forum.arduino.cc/index.php?topic=146802.0 saying there are something wrong with Due's I2C. But understanding the post is beyond me. Some of them saying replace Wire.cpp would fix the I2C bug, but I tried and only got compile errors.
I tried with two different Due and it still can't find MPR121.
Is there any issues with Due's I2C communication you know of?
I found this post http://forum.arduino.cc/index.php?topic=146802.0 saying there are something wrong with Due's I2C. But understanding the post is beyond me. Some of them saying replace Wire.cpp would fix the I2C bug, but I tried and only got compile errors.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MPR121 Touch Sensor Breakout Demo Error
Try this version of the library. Delete the old version.
Connect your MPR to SDA1 and SCL1 (in the upper left, near digital 13)
Connect your MPR to SDA1 and SCL1 (in the upper left, near digital 13)
- Attachments
-
- Adafruit_MPR121.zip
- (38.7 KiB) Downloaded 269 times
- erikbrandl
- Posts: 1
- Joined: Mon Jun 20, 2016 2:31 pm
Re: MPR121 Touch Sensor Breakout Demo Error
Hi Rick,
Is there any news about the Problem?
I have the same Problem as yishi and your library didn`t solve it...
I have the shield as well as the breakout Mpr121, I tried on an uno and both worked. Just the due makes problems.
It gives me :
Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?
Any suggestions?
Thanks alot!
erik
Is there any news about the Problem?
I have the same Problem as yishi and your library didn`t solve it...
I have the shield as well as the breakout Mpr121, I tried on an uno and both worked. Just the due makes problems.
It gives me :
Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?
Any suggestions?
Thanks alot!
erik
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MPR121 Touch Sensor Breakout Demo Error
Have you updated to the latest board support package for the Due?
You're using SCL1 and SDA1 for the I2C connection?
You're using SCL1 and SDA1 for the I2C connection?
- baynesstua
- Posts: 3
- Joined: Thu Mar 22, 2018 7:01 pm
Re: MPR121 Touch Sensor Breakout Demo Error
Hi, I have the exact same issue and have used this solution, but is still not fixed. Is there any update to this problem? Any solution would be much appreciated!. Thanksadafruit_support_rick wrote:Try this version of the library. Delete the old version.
Connect your MPR to SDA1 and SCL1 (in the upper left, near digital 13)
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: MPR121 Touch Sensor Breakout Demo Error
Did you download and install the zipped version of the library, posted above?
As far as I know, the MPR121 works with the Due
I don't have one to test with here. I can get one and try it out.
As far as I know, the MPR121 works with the Due
I don't have one to test with here. I can get one and try it out.
Please be positive and constructive with your questions and comments.