smooth輸入(10個值平均值侥蒙,新值與前9個值)
int readings[numReadings];
void loop() {
total= total - readings[readIndex];
readings[readIndex] = analogRead(inputPin);
total= total + readings[readIndex];
readIndex = readIndex + 1;
if (readIndex >= numReadings)
readIndex = 0;
average = total / numReadings;}