Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attiny 0/1 series #11

Open
agrimagsrl opened this issue Dec 9, 2021 · 3 comments
Open

Attiny 0/1 series #11

agrimagsrl opened this issue Dec 9, 2021 · 3 comments

Comments

@agrimagsrl
Copy link

Is there any chance you can support the new Attiny 0/1 series?
ADMUX is not defined (in the Arduino IDE at least).

@martin2250
Copy link
Owner

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

@agrimagsrl
Copy link
Author

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;
    }

@hghile
Copy link

hghile commented Feb 27, 2024

Seems like this should do it?
https://github.com/SpenceKonde/ADCTouch/tree/master/src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants