Franz Pucher
/
app-AnalogOut_Umpolen_Noten
12-stufige chromatische Skala der reinen Stimmung
main.cpp@2:d082f336c9a2, 2019-12-04 (annotated)
- Committer:
- fpucher
- Date:
- Wed Dec 04 15:09:31 2019 +0000
- Revision:
- 2:d082f336c9a2
- Parent:
- 1:754db1ff50f2
Noten erster Versuch
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fpucher | 2:d082f336c9a2 | 1 | // 12-stufige chromatische Skala der reinen Stimmung |
fpucher | 2:d082f336c9a2 | 2 | // https://de.wikipedia.org/wiki/Reine_Stimmung |
fpucher | 2:d082f336c9a2 | 3 | |
chris | 0:1a38bf78f122 | 4 | #include "mbed.h" |
fpucher | 2:d082f336c9a2 | 5 | #include "noten.h" |
chris | 0:1a38bf78f122 | 6 | |
chris | 0:1a38bf78f122 | 7 | AnalogOut Aout(p18); |
chris | 1:754db1ff50f2 | 8 | AnalogIn pot1(p19); |
chris | 0:1a38bf78f122 | 9 | |
fpucher | 2:d082f336c9a2 | 10 | void note(float time) { |
fpucher | 2:d082f336c9a2 | 11 | for(float i = 0.0; i < 1.0; i+=0.01) { |
fpucher | 2:d082f336c9a2 | 12 | Aout = 0.2; // Lautstärke |
fpucher | 2:d082f336c9a2 | 13 | wait_us(time*1000); // Frequenz |
fpucher | 2:d082f336c9a2 | 14 | Aout = 0; |
fpucher | 2:d082f336c9a2 | 15 | wait_us(time*1000); |
chris | 0:1a38bf78f122 | 16 | } |
chris | 0:1a38bf78f122 | 17 | } |
fpucher | 2:d082f336c9a2 | 18 | |
fpucher | 2:d082f336c9a2 | 19 | int main() { |
fpucher | 2:d082f336c9a2 | 20 | while(1) { |
fpucher | 2:d082f336c9a2 | 21 | note(C); //0.000.01 |
fpucher | 2:d082f336c9a2 | 22 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 23 | note(Des); |
fpucher | 2:d082f336c9a2 | 24 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 25 | note(D); |
fpucher | 2:d082f336c9a2 | 26 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 27 | note(Es); |
fpucher | 2:d082f336c9a2 | 28 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 29 | note(E); |
fpucher | 2:d082f336c9a2 | 30 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 31 | note(F); |
fpucher | 2:d082f336c9a2 | 32 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 33 | note(Fis); |
fpucher | 2:d082f336c9a2 | 34 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 35 | note(G); |
fpucher | 2:d082f336c9a2 | 36 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 37 | note(As); |
fpucher | 2:d082f336c9a2 | 38 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 39 | note(A); |
fpucher | 2:d082f336c9a2 | 40 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 41 | note(B); |
fpucher | 2:d082f336c9a2 | 42 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 43 | note(H); |
fpucher | 2:d082f336c9a2 | 44 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 45 | note(c); |
fpucher | 2:d082f336c9a2 | 46 | wait(0.5); |
fpucher | 2:d082f336c9a2 | 47 | } |
fpucher | 2:d082f336c9a2 | 48 | } |