/******************************************* * Week8 Fabric Speaker ******************************************/ //const int spPin = 6; //Arduino UNO const int spPin = 1; //Gemma void setup() { pinMode(spPin,OUTPUT); } void loop() { //hz1000(); toneOut(); } void hz1000(){ digitalWrite(spPin, HIGH); delayMicroseconds(500); digitalWrite(spPin, LOW); delayMicroseconds(500); } void toneOut(){ //tone(pin, frequency, duration Usec) tone(spPin,261.626,1000000000); //c4 delay(1000); noTone(spPin); delay(50); tone(spPin,261.626,1000000000); //c4 delay(1000); tone(spPin,391.995,1000000000); //G4 delay(1000); noTone(spPin); delay(50); tone(spPin,391.995,1000000000); //G4 delay(1000); tone(spPin,440.000,1000000000); //A4 delay(1000); noTone(spPin); delay(50); tone(spPin,440.000,1000000000); //A4 delay(1000); tone(spPin,391.995,1000000000); //G4 delay(2000); tone(spPin,349.228,1000000000); //F4 delay(1000); noTone(spPin); delay(50); tone(spPin,349.228,1000000000); //F4 delay(1000); tone(spPin,329.628,1000000000); //E4 delay(1000); noTone(spPin); delay(50); tone(spPin,329.628,1000000000); //E4 delay(1000); tone(spPin,293.665,1000000000); //D4 delay(1000); noTone(spPin); delay(50); tone(spPin,293.665,1000000000); //D4 delay(1000); tone(spPin,261.626,1000000000); //c4 delay(2000); noTone(spPin); delay(200); }