ARDUINO CODE?

Dear Sir,

I want to average of ldr sencer result smooth average of last 10 result

but

............????//??

void setup() {

Serial.begin(9600); // sets serial port for communication

pinMode(A, OUTPUT);

pinMode(ANALOGpin,INPUT);

}

void loop() {

digitalWrite(A,HIGH);

ANALOGValue = analogRead(ANALOGpin); // read the value

Serial.print(ANALOGValue); // print the value to the serial port

Serial.print("\t");

delay(400);

digitalWrite(A,LOW);

delay(400);

}

and result is

978

994

974

977

982

961

969

979

979

1001

992

988

979

979

971

980

973

956

977


bekathwia2 months ago

Sure! It's called smoothing: https://www.arduino.cc/en/Tutorial/Smoothing