Ignore first sample from ADC

ADC of AVR contains a 'bug' that causes first sample to be corrupt. Fixed in
code now.
This commit is contained in:
Admar Schoonen 2012-01-04 23:13:05 +01:00
parent ff698171aa
commit 6cf277c1fe
1 changed files with 3 additions and 0 deletions

View File

@ -194,6 +194,9 @@ void setup()
pinMode(LED4PIN, OUTPUT);
analogReference(DEFAULT);
// known 'bug' in AVR ADC: after switching analog reference, first sample
// could be corrupt and should be ignored --> discard this sample now
analogRead(LIGHTSENSOR_INPUTPIN);
current_brightnes=MAXBRIGHTNESS;