题目内容
三人抢答器的软件程序代码如下:int redled = 11;int yellowled =12;int greenled = 13;int redpin = 7;int yellowpin = 8;int greenpin = 9;int offswitch = 10;int red;int yellow;int green;int i = ; //①void setup(){pinMode(redled, OUTPUT);pinMode(yellowled, OUTPUT);pinMode(greenled, OUTPUT);pinMode(redpin, INPUT);pinMode(yellowpin, INPUT);pinMode(greenpin, INPUT);pinMode(offswitch, INPUT);}void loop(){ red = (redpin); //②if (red == HIGH && i == 0){ i = 1;digitalWrite(redled, HIGH);}yellow = digitalRead(yellowpin);if (yellow == HIGH&&i == 0){ i = ; //③digitalWrite(yellowled, HIGH);}green = digitalRead(greenpin);if (green ==HIGH && i == 0 ){i=1;digitalWrite(greenled, HIGH);}if (digitalRead(offswitch) == HIGH){ i = 0;digitalWrite(redled, LOW);digitalWrite(yellowled, LOW);digitalWrite(greenled, LOW);}}在以上程序中①处int i =②处red =(redpin); ③处i =; 该程序设计采用了(单、双、多)分支选择结构。
查看答案
搜索结果不匹配?点我反馈