Hello,
Is someone able to help me understand the ADC nad PWM setup? What are the values of chosen registers responsible for? Are there any possibilities to rewrite the code in more arduino-like way?
// setup ADC
ADMUX = 0x60; // left adjust, adc0, internal vcc
ADCSRA = 0xe5; // turn on adc, ck/32, auto trigger
ADCSRB = 0x07; // t1 capture for trigger
DIDR0 = 0x01; // turn off digital inputs for adc0
This is an elegant solution that reveals the full potential of the controller.
It’s better not to change these settings, because, in my opinion, they are very good.
Arduino functions are intended for widespread use in various tasks, they are also good, but they will be too slow for our task.