Skip to content

Instantly share code, notes, and snippets.

@sw13sg
Last active February 16, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw13sg/4a9be78733d4f83b33590f3bf5e70740 to your computer and use it in GitHub Desktop.
Save sw13sg/4a9be78733d4f83b33590f3bf5e70740 to your computer and use it in GitHub Desktop.
/*
Expressive Wearable: Circada
Sinead Wickham (2504397)
GDES-3015-001 Wearable Computing
OCAD Univeristy
Created on Feb 16, 2017
Based on:
Make-Wearable-Electronics/MWE_Ch08_Tone, Kate Hartman, https://github.com/katehartman/Make-Wearable-Electronics/blob/master/MWE_Ch08_Tone/MWE_Ch08_Tone.ino
Make-Wearable-Electronics/MWE_Ch08_Buzzer, Kate Hartman, https://github.com/katehartman/Make-Wearable-Electronics/blob/master/MWE_Ch08_Buzzer/MWE_Ch08_Buzzer.ino
*/
int B = 1976;
int D = 1175;
int F = 1397;
int buzzerPin = 9;
int buttonPin = 12;
int buttonValue;
void setup() {
pinMode (buzzerPin, OUTPUT);
pinMode (buttonPin, INPUT_PULLUP);
}
void loop() {
buttonValue = digitalRead(buttonPin);
if (buttonValue == HIGH) {
tone(buzzerPin, B, 50);
delay(75);
tone(buzzerPin, B, 50);
delay(10000);
} else {
tone(buzzerPin, B, 200);
delay(400);
tone(buzzerPin, D, 200);
delay(400);
tone(buzzerPin, F, 200);
delay(400);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment