Some time ago a started using a seeeduino xiao, just for debugging functions and sensors. It works perfectly well. So now I its time to put it to work in a real application. It wil be a controller for solar powered compressor refrigerator with touchpad and screen.
But the most basic thing does not work; it does not start without a trigger from the ide serial monitor. The blink program works fine standalone, but my simple script does not, have a look:
#include "Adafruit_FreeTouch.h"
Adafruit_FreeTouch qt_1 = Adafruit_FreeTouch(A6, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE);
Adafruit_FreeTouch qt_2 = Adafruit_FreeTouch(A7, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE);
void setup() {
SerialUSB.begin(115200);
if (! qt_1.begin())
SerialUSB.println("Failed to begin qt on pin A6");
if (! qt_2.begin())
SerialUSB.println("Failed to begin qt on pin A7");
pinMode(LED_BUILTIN, OUTPUT);
}
int qt1_Threshold = 260;
int qt2_Threshold = 250;
void loop()
{
int qt1 = 0;
int qt2 = 0;
qt1 = qt_1.measure();
qt2 = qt_2.measure();
if (qt1 >= qt1_Threshold) {
SerialUSB.print("qt1: ");
SerialUSB.println(qt1);
}
if (qt2 >= qt2_Threshold) {
SerialUSB.print("qt2: ");
SerialUSB.println(qt2);
}
delay(500);
}
I hope someone know what going on.
Thank you,
Ray