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

AutomationShield compatibitliy with DUE - ADC resolution #211

Open
KuboJakub opened this issue Mar 30, 2020 · 2 comments
Open

AutomationShield compatibitliy with DUE - ADC resolution #211

KuboJakub opened this issue Mar 30, 2020 · 2 comments
Labels
AutomationShield common Common functionality for the entire library

Comments

@KuboJakub
Copy link
Contributor

Arduino DUE has 12-bit ADC so I have changed the analog reference code. But i did not know that default resolution for DUE is 10-bit, you have to change it in the code with "analogReadResolution(bits)".
My question is, are we gonna use this advantage of DUE and every library will include this code for the case of use DUE or ZERO, or do we use default settings for 10-bit resolution of the ADC for all boards?

#elif ARDUINO_ARCH_SAMD || ARDUINO_ARCH_SAM // Chip uses 12-bit ADC

To see what I added to make 12-bit resolution in Magneto library chack the link:
#elif ARDUINO_ARCH_SAM

@KuboJakub
Copy link
Contributor Author

There is an issue that if we use 12-bit resolution for DUE, all functions for converting data from analog pins have to be defined for both boards... It means if I read analog position from a sensor and wanna convert it to percents:
data*(100/1023) for UNO
data*(100/4095) for DUE
So library have to have a rework (maybe in .h file) where all 1023 which are used e.g. in mapFloat() function, will be replaced by 4095.... I hope, you know what i mean.

@gergelytakacs
Copy link
Owner

gergelytakacs commented Apr 9, 2020

Okay, I understand. However you need to be more specific what do you need to rework there for the rest of the team.

Okay, but that means nobody should hard - code the numbers 1023 or 4095, instead to use AREF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutomationShield common Common functionality for the entire library
Projects
None yet
Development

No branches or pull requests

10 participants