EdgeBotix / Mbed 2 deprecated eBot_Firmware_V1

Dependencies:   mbed HC05 QEI MODSERIAL SWSPI mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tone.h Source File

tone.h

00001 /* Star Wars Song Selector
00002  * -----------
00003  *
00004  * Program to choose between two melodies by using a potentiometer and a piezo buzzer.
00005  * Inspired by: https://code.google.com/p/rbots/source/browse/trunk/StarterKit/Lesson5_PiezoPlayMelody/Lesson5_PiezoPlayMelody.pde
00006  */
00007  
00008 // TONES //
00009 // Defining the relationship between note, period & frequency. 
00010  
00011 // period is in microsecond so P = 1/f * (1E6)
00012 #ifndef TONE_H
00013 #define TONE_H
00014 #include "mbed.h" 
00015 #define  c3    7634
00016 #define  d3    6803
00017 #define  e3    6061
00018 #define  f3    5714
00019 #define  g3    5102
00020 #define  a3    4545
00021 #define  b3    4049
00022 #define  c4    3816    // 261 Hz 
00023 #define  d4    3401    // 294 Hz 
00024 #define  e4    3030    // 329 Hz 
00025 #define  f4    2865    // 349 Hz 
00026 #define  g4    2551    // 392 Hz 
00027 #define  a4    2272    // 440 Hz 
00028 #define  a4s   2146
00029 #define  b4    2028    // 493 Hz 
00030 #define  c5    1912    // 523 Hz
00031 #define  d5    1706
00032 #define  d5s   1608
00033 #define  e5    1517    // 659 Hz
00034 #define  f5    1433    // 698 Hz
00035 #define  g5    1276
00036 #define  a5    1136
00037 #define  a5s   1073
00038 #define  b5    1012
00039 #define  c6    955
00040  
00041 #define  R     0      // Define a special note, 'R', to represent a rest
00042  
00043 #define buzz PTC8 
00044 // SETUP //
00045  
00046 void imperial_march();
00047  #endif