Vscode编程arduino,定义了Clear函数时候报错,报错内容如下
源程序如下
#include <Arduino.h>
void setup() {
int pinNumber = 3;
while(pinNumber <= 9){
pinMode(pinNumber, OUTPUT);
pinNumber = pinNumber + 1;
}
}
// the loop function runs over and over again forever
void loop() {
int myNumber = random(0, 4);
switch(myNumber) {
case 1: //显示1
digitalWrite(4, HIGH);
digitalWrite(7, HIGH);
break;
case 2: //显示2
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
break;
case 3: //显示3
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
break;
default:
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
}
delay(500);
Clear(); //调用函数
delay(500);
}
void Clear() { //定义函数清理显示内容
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
运行结果及报错内容
请问这是怎么一回事呢?