问题遇到的现象和发生背景
遇到的现象和发生背景,请写出第一个错误信息
用代码块功能插入代
情况是这莫个情况,Arduino 的以下代码存在错误,可能是参数问题.我是要做一个三路抢答器的,需要满足的要求是当一轮抢答开始后,假如红(1号)抢到了,此时其余两个按键失效,且一位数码管显示数字1,同理2,3。每当一轮结束,裁判会来按下复位键使得数码管上的数字是0且蜂鸣器发出响声希望各位dl帮帮忙,改正改正吧
bool state =1;
int redled =3;
int greenled =4;
int yellowled =5;
int redkey =A0;
int greenkey =A1;
int yellowkey =A2;
int resetkey =A3;
int a=2;
int b=6;
int c=7;
int d=8;
int e=9;
int f=10;
int g=11;
int buzzer=A4;
void setup() {
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(A3,INPUT);
Serial.begin(9600);
void digital_0(void);{
digitalWrite(2,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(10,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(11,LOW); }//显示数字0
pinMode(A4,INPUT);
void digital_1(void);{
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(2,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW); }//显示数字1
void digital_2(void);{
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
digitalWrite(2,HIGH);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);}//显示数字2
void digital_3(void);{
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(2,HIGH);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
digitalWrite(9,LOW);
digitalWrite(8,HIGH);}//显示数字3
}
void loop() {
if(!digitalWrite(A2)&& state==1){
digitalWrite(5,HIGH);
state=0;
digital_1;
digitalRead(6,1);
digitalRead(7,1);
}
if(!digitalWrite(A1)&& state==1){
digitalWrite(4,HIGH);
state=0;
digital_2;
digitalRead(2,1);
digitalRead(6,1);
digitalRead(8,1);
digitalRead(9,1);
digitalRead(11,1);
}
if(!digitalWrite(A0)&& state==1){
digitalWrite(3,HIGH);
state=0;
digital_3;
digitalRead(2,1);
digitalRead(6,1);
digitalRead(7,1);
digitalRead(8,1);
digitalRead(11,1);
}
if (!digitalRead(A4)&& state==0) {
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
state = 1;
digitalWrite(A4,HIGH);
digital_0;
digitalRead(2,1);
digitalRead(6,1);
digitalRead(7,1);
digitalRead(8,1);
digitalRead(9,1);
digitalRead(10,1);
}
Serial.println(state);
}