Fixed to work with paper potentiometer
Dependencies: mbed
main.cpp@1:d16782f51626, 2017-10-06 (annotated)
- Committer:
- ziadeldebri
- Date:
- Fri Oct 06 16:17:21 2017 +0000
- Revision:
- 1:d16782f51626
- Parent:
- 0:dcdfee042939
D3 PWM for both KL46 /KL43 z
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halea | 0:dcdfee042939 | 1 | #include "mbed.h" |
halea | 0:dcdfee042939 | 2 | #include "Music.h" |
halea | 0:dcdfee042939 | 3 | #include "AnalogIn.h" |
halea | 0:dcdfee042939 | 4 | |
halea | 0:dcdfee042939 | 5 | /*! Main class. |
halea | 0:dcdfee042939 | 6 | * Creates an instance of the Music class, and then connects it to an output, which should |
halea | 0:dcdfee042939 | 7 | * be connected to a small speaker. |
halea | 0:dcdfee042939 | 8 | * \author Alex Hale |
halea | 0:dcdfee042939 | 9 | * |
halea | 0:dcdfee042939 | 10 | * \date August 14th, 2016 |
halea | 0:dcdfee042939 | 11 | */ |
halea | 0:dcdfee042939 | 12 | |
halea | 0:dcdfee042939 | 13 | //#define STARTING_NOTE 80 |
halea | 0:dcdfee042939 | 14 | |
halea | 0:dcdfee042939 | 15 | AnalogIn readVoltage(A0); |
halea | 0:dcdfee042939 | 16 | //DigitalOut mySpeaker(D0); |
halea | 0:dcdfee042939 | 17 | |
halea | 0:dcdfee042939 | 18 | int main() |
halea | 0:dcdfee042939 | 19 | { |
ziadeldebri | 1:d16782f51626 | 20 | Music myMusic(D3); |
halea | 0:dcdfee042939 | 21 | |
halea | 0:dcdfee042939 | 22 | while (true) { |
halea | 0:dcdfee042939 | 23 | //myMusic.playNote(int(readValue.read())); |
halea | 0:dcdfee042939 | 24 | myMusic.playNote(readVoltage.read()*80.f); |
halea | 0:dcdfee042939 | 25 | }//end of while |
halea | 0:dcdfee042939 | 26 | }//end of main |
halea | 0:dcdfee042939 | 27 | |
halea | 0:dcdfee042939 | 28 |