Franz Pucher
/
app-AnalogOut_Umpolen
Ausgabefrequenz durch Umpolung und Lautstärke mit Poti einstellen
Revision 3:a6ab24f494f7, committed 2019-12-04
- Comitter:
- fpucher
- Date:
- Wed Dec 04 15:24:55 2019 +0000
- Parent:
- 2:d082f336c9a2
- Commit message:
- Erster Versuch
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
noten.h | Show diff for this revision Revisions of this file |
diff -r d082f336c9a2 -r a6ab24f494f7 main.cpp --- a/main.cpp Wed Dec 04 15:09:31 2019 +0000 +++ b/main.cpp Wed Dec 04 15:24:55 2019 +0000 @@ -1,48 +1,13 @@ -// 12-stufige chromatische Skala der reinen Stimmung -// https://de.wikipedia.org/wiki/Reine_Stimmung - #include "mbed.h" -#include "noten.h" AnalogOut Aout(p18); AnalogIn pot1(p19); -void note(float time) { - for(float i = 0.0; i < 1.0; i+=0.01) { - Aout = 0.2; // Lautstärke - wait_us(time*1000); // Frequenz - Aout = 0; - wait_us(time*1000); - } -} - int main() { while(1) { - note(C); //0.000.01 - wait(0.5); - note(Des); - wait(0.5); - note(D); - wait(0.5); - note(Es); - wait(0.5); - note(E); - wait(0.5); - note(F); - wait(0.5); - note(Fis); - wait(0.5); - note(G); - wait(0.5); - note(As); - wait(0.5); - note(A); - wait(0.5); - note(B); - wait(0.5); - note(H); - wait(0.5); - note(c); - wait(0.5); + Aout = pot1.read(); // Lautstärke + wait_us(1000); // Frequenz + Aout = 0; + wait_us(1000); } }
diff -r d082f336c9a2 -r a6ab24f494f7 noten.h --- a/noten.h Wed Dec 04 15:09:31 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -//https://de.wikipedia.org/wiki/Reine_Stimmung#Vergleich_der_erweiterten_reinen_Stimmung_mit_der_gleichstufigen_Stimmung -#ifndef NOTEN_H -#define NOTEN_H -#define C 3.787878788 -#define Des 3.551136364 -#define D 3.367003367 -#define Es 3.156565657 -#define E 3.03030303 -#define F 2.840909091 -#define Fis 2.693602694 -#define G 2.525252525 -#define As 2.367424242 -#define A 2.272727273 -#define B 2.104377104 -#define H 2.02020202 -#define c 1.893939394 -#endif \ No newline at end of file