ADCTouch
ADCTouch copied to clipboard
Attiny 0/1 series
Is there any chance you can support the new Attiny 0/1 series? ADMUX is not defined (in the Arduino IDE at least).
Hi Simone, I currently don't have time to work on adding support for new chips. That said, if you (or someone else) want to work on it, I'd be happy to accept pull requests 😉 Cheers
I wish I could understand half the code you wrote... I know nothing about registers. I found a different approach that works for my use-case. I will report here just in case someone else needs it. It's dirty naive, but I only need to get a rough idea of how much a touch sensor was "touched".
uint16_t read(uint8_t pin) {
// write HIGH to pin, then LOW, then read its voltage
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
delay(50);
digitalWrite(pin, LOW);
pinMode(pin, INPUT);
uint16_t readings[numReadings];
uint16_t sum = 0;
for (int i = 0; i < numReadings; i++)
readings[i] = analogRead(pin);
for (int i = 0; i < numReadings; i++)
sum += readings[i];
return sum / numReadings;
}
Seems like this should do it?
https://github.com/SpenceKonde/ADCTouch/tree/master/src