10/26

作者: 王子龙同学 | 来源:发表于2017-10-30 09:11 被阅读0次

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;}

相关文章

网友评论

      本文标题:10/26

      本文链接:https://www.haomeiwen.com/subject/ctfppxtx.html