![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Very simple frequency program that assigns a frequency to a note
main.cpp@0:76182452ce7f, 2015-11-30 (annotated)
- Committer:
- taptoneesarm
- Date:
- Mon Nov 30 16:24:50 2015 +0000
- Revision:
- 0:76182452ce7f
Really simple frequency program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taptoneesarm | 0:76182452ce7f | 1 | // The mBed interprets an alternating |
taptoneesarm | 0:76182452ce7f | 2 | // current as a result of detected frequency |
taptoneesarm | 0:76182452ce7f | 3 | // from the pickup/piezo from a played chord[input] |
taptoneesarm | 0:76182452ce7f | 4 | |
taptoneesarm | 0:76182452ce7f | 5 | // The mBed then devises an output as |
taptoneesarm | 0:76182452ce7f | 6 | // a pattern of LED lights to indicate |
taptoneesarm | 0:76182452ce7f | 7 | // the given chord [output] |
taptoneesarm | 0:76182452ce7f | 8 | |
taptoneesarm | 0:76182452ce7f | 9 | #include "mbed.h" |
taptoneesarm | 0:76182452ce7f | 10 | #include <cstdio> |
taptoneesarm | 0:76182452ce7f | 11 | #include <cstdlib> |
taptoneesarm | 0:76182452ce7f | 12 | #include <iostream> |
taptoneesarm | 0:76182452ce7f | 13 | DigitalOut myled(LED1); |
taptoneesarm | 0:76182452ce7f | 14 | |
taptoneesarm | 0:76182452ce7f | 15 | int main(int nNumberofArgs, char* pszArgs[]) { |
taptoneesarm | 0:76182452ce7f | 16 | int freq; |
taptoneesarm | 0:76182452ce7f | 17 | string actualFreq; |
taptoneesarm | 0:76182452ce7f | 18 | cout << "Enter a frequency in kilohertz" << endl; |
taptoneesarm | 0:76182452ce7f | 19 | cin >> freq; |
taptoneesarm | 0:76182452ce7f | 20 | if (-0.5<(16.35 - freq)<0.5); |
taptoneesarm | 0:76182452ce7f | 21 | { |
taptoneesarm | 0:76182452ce7f | 22 | actualFreq = "C0"; |
taptoneesarm | 0:76182452ce7f | 23 | } |
taptoneesarm | 0:76182452ce7f | 24 | cout << "Your chord is " << actualFreq; |
taptoneesarm | 0:76182452ce7f | 25 | cout << "Press Enter to continue" << endl; |
taptoneesarm | 0:76182452ce7f | 26 | return.0; |
taptoneesarm | 0:76182452ce7f | 27 | } |