Guys, I am having some problems with the CapTouch library and need some help from the experts to resolve this.
I modified (stripped) the CapTouch button example an uploaded that code to a G2553:
#include <CapTouch.h>
#define LEFT_BUTTON 10
#define MIDDLE_LED P1_6
uint8_t state = false;
CapTouch left = CapTouch(LEFT_BUTTON, TOUCH_BUTTON);
void setup() {
/* Use the middle LED to indicate touch */
pinMode(MIDDLE_LED, OUTPUT);
}
void loop() {
/* State will be 1 if any of the buttons was touched, otherwise 0 */
state = left.isTouched();
/* Turn on the LED if any of the buttons was touched */
digitalWrite(MIDDLE_LED, state);
}
This code runs fine for over 20 hours but then stalls. The the green led (as defined in the code) is constantly on and the board no longer responses.
Any clues to what might cause this behaviour?