# | Name | Number | Note |
---|---|---|---|
1 | Shanghaiuno board | 1 | Arduino UNO is OK too |
2 | Potentialmeter | 5 | The number is determined by you |
3 | Slient Buzzer | 5 | The number is the same as potentialmeter |
4 | Button | 1 | ### |
5 | LED light | 2 | Different colours |
6 | Wires | Decided by you | ### |
7 | Breadboard | 1 | ### |
We have done a very simple circuit to realize playing some simple music such as Happy Song. Then, this is our core, we need to plus some more features on it. Actually, what I want to finally present is an effector, which can change the output frequency by control some types of input.
digitalWrite(7,HIGH);
digitalWrite(4,LOW);
while (digitalRead(2) == 0) {
int add_val1 = -200 + (int)(analogRead(A0) / 2.5);
int add_val2 = -200 + (int)(analogRead(A1) / 2.5);
int add_val3 = -200 +(int)(analogRead(A2) / 2.5);
int now_delay = (int)analogRead(A3) / 5;
tone(outpin,800+add_val1);
delay(now_delay);
noTone(outpin);
tone(outpin2, 1000+add_val2);
delay(now_delay);
noTone(outpin2);
tone(outpin3,1200+add_val3);
delay(now_delay);
noTone(outpin3);
}
noTone(outpin);
noTone(outpin2);
noTone(outpin3);
state = 1;
}
delay(500);
}