Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TextLCD mbed MMA8451Q TSI
main.cpp@3:a703eda2b125, 2015-08-15 (annotated)
- Committer:
- mfurlanetto
- Date:
- Sat Aug 15 13:56:42 2015 +0000
- Revision:
- 3:a703eda2b125
- Parent:
- 2:86de87ec731a
- Child:
- 4:f4bd9fe2200b
3 suoni base, no led
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mfurlanetto | 0:f48fccfff709 | 1 | #include "mbed.h" |
| mfurlanetto | 0:f48fccfff709 | 2 | #include <Button.cpp> |
| mfurlanetto | 1:47973f27d645 | 3 | #include "TextLCD.h" |
| mfurlanetto | 0:f48fccfff709 | 4 | |
| mfurlanetto | 0:f48fccfff709 | 5 | #define DO4 262 |
| mfurlanetto | 0:f48fccfff709 | 6 | #define RE4 294 |
| mfurlanetto | 0:f48fccfff709 | 7 | #define MI4 330 |
| mfurlanetto | 0:f48fccfff709 | 8 | #define FA4 349 |
| mfurlanetto | 0:f48fccfff709 | 9 | #define SOL4 392 |
| mfurlanetto | 0:f48fccfff709 | 10 | #define LA4 440 |
| mfurlanetto | 0:f48fccfff709 | 11 | #define SI4 494 |
| mfurlanetto | 0:f48fccfff709 | 12 | |
| mfurlanetto | 2:86de87ec731a | 13 | TextLCD lcd(PTE5, PTE3, PTE2, PTB11, PTB10, PTB9, TextLCD::LCD16x2); //TextLCD (PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type=LCD16x2, PinName bl=NC, PinName e2=NC, LCDCtrl ctrl=HD44780) |
| mfurlanetto | 0:f48fccfff709 | 14 | Speaker speaker (PTA4); |
| mfurlanetto | 0:f48fccfff709 | 15 | DigitalOut led1(LED1); |
| mfurlanetto | 0:f48fccfff709 | 16 | DigitalOut led2(LED2); |
| mfurlanetto | 0:f48fccfff709 | 17 | DigitalOut led3(LED3); |
| mfurlanetto | 1:47973f27d645 | 18 | int freq =0; |
| mfurlanetto | 3:a703eda2b125 | 19 | int multiplier =1; |
| mfurlanetto | 3:a703eda2b125 | 20 | |
| mfurlanetto | 0:f48fccfff709 | 21 | |
| mfurlanetto | 0:f48fccfff709 | 22 | int main(){ |
| mfurlanetto | 0:f48fccfff709 | 23 | led1=1; |
| mfurlanetto | 0:f48fccfff709 | 24 | led2=1; |
| mfurlanetto | 0:f48fccfff709 | 25 | led3=1; |
| mfurlanetto | 3:a703eda2b125 | 26 | Button a (PTA1, LA4, &freq, &multiplier); |
| mfurlanetto | 3:a703eda2b125 | 27 | Button b (PTA2, DO4, &freq, &multiplier); |
| mfurlanetto | 3:a703eda2b125 | 28 | Button c (PTA12, FA4, &freq, &multiplier); |
| mfurlanetto | 2:86de87ec731a | 29 | lcd.cls(); |
| mfurlanetto | 0:f48fccfff709 | 30 | while (true){ |
| mfurlanetto | 1:47973f27d645 | 31 | if(freq>0){ |
| mfurlanetto | 1:47973f27d645 | 32 | speaker.PlayNote(freq, 0.005, 0.2); |
| mfurlanetto | 1:47973f27d645 | 33 | } |
| mfurlanetto | 2:86de87ec731a | 34 | /* lcd.printf("%d", freq); |
| mfurlanetto | 2:86de87ec731a | 35 | wait(0.1); |
| mfurlanetto | 2:86de87ec731a | 36 | lcd.cls(); */ |
| mfurlanetto | 0:f48fccfff709 | 37 | } |
| mfurlanetto | 0:f48fccfff709 | 38 | } |
