Gemma Morse Code

// by chris@drumminhands.com
// send morse code signals to the motor
// find morse code charts here: https://en.wikipedia.org/wiki/Morse_code

int m = 1; // motor pin
int dotDuration = 250; // duration of a morse code dot in miliseconds
int dashDuration = 3*dotDuration; // duration of a morse code dash in miliseconds
int delayBetweenChars = 250; // pause duration between buzzing each character

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(m, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
// s
dot();
dot();
dot();

delay(500);

// o
dash();
dash();
dash();

delay(500);

// s
dot();
dot();
dot();

delay(2000);
}

void buzz(int p, int d){
// buzzes the motor connected to pin p, for duration d (in miliseconds)
digitalWrite(p, HIGH);
delay(d);
digitalWrite(p, LOW);
delay(delayBetweenChars);
}

void dot(){
// buzzes the motor for a short pulse
buzz(m,dotDuration);
}

void dash(){
buzz(m,dashDuration); // three times a dash
}