2.小蜜蜂
533
422
1234555
533
422
13551
3.int buttonPin = 2;
int buttonPin3 = 3;
int buttonPin4 = 4;
int buttonPin5 = 5;
int buttonPin6 = 6;
int buttonState = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
pinMode(buttonPin6, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);
buttonState5 = digitalRead(buttonPin5);
buttonState6 = digitalRead(buttonPin6);
if (buttonState == HIGH) {
tone(8, 131, 10);
}
if (buttonState3== HIGH) {
tone(8, 147 , 10);
}
if (buttonState4 == HIGH) {
tone(8, 165 , 10);
}
if (buttonState5 == HIGH) {
tone(8, 175 , 10);
}
if (buttonState6 == HIGH) {
tone(8, 196, 10);
}
}
沒有留言:
張貼留言