Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte backup = ADMUX; // store the arduino settings
- ADMUX = _BV(REFS1) | _BV(MUX3) | _BV(MUX0); // internal 1.1V reference, differential: ADC1+ ADC0-, gain: 10x
- ADCSRA |= _BV(ADSC); // start conversion
- while ((ADCSRA & _BV(ADSC)) != 0); // wait for conversion end (ADSC is cleared after the end by hardware)
- int val = ADC; // read the result
- ADMUX = backup; // restore original settings (from arduino)
Add Comment
Please, Sign In to add comment