You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
673 B
Arduino
47 lines
673 B
Arduino
5 years ago
|
void setup() {
|
||
|
Serial.begin(9600);
|
||
|
}
|
||
|
|
||
|
|
||
|
char pat[] = "111011010110";
|
||
|
|
||
|
|
||
|
void loop() {
|
||
|
|
||
|
int i = 0;
|
||
|
int x = 0;
|
||
|
// variable equals 0
|
||
|
|
||
|
for (x=1; x<12; x++) {
|
||
|
while (i<12) {
|
||
|
// do something with i
|
||
|
if (pat[i] == '1') {
|
||
|
tone(11, 440, 40);
|
||
|
delay(40);
|
||
|
// Serial.println(111);
|
||
|
}
|
||
|
// if (pat[i] == '2') {
|
||
|
// tone(11, 880, 40);
|
||
|
// delay(300);
|
||
|
// Serial.println(222);
|
||
|
// }
|
||
|
|
||
|
if (pat[i-x % 12] == '1') {
|
||
|
tone(11, 220, 40);
|
||
|
delay(40);
|
||
|
// Serial.println(111);
|
||
|
}
|
||
|
|
||
|
|
||
|
delay(150);
|
||
|
//Serial.println(000);
|
||
|
|
||
|
//Serial.println(i);
|
||
|
//echo to monitor
|
||
|
i++;
|
||
|
|
||
|
//increment i
|
||
|
}
|
||
|
}
|
||
|
}
|