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
Diff: main.cpp
- Revision:
- 2:86de87ec731a
- Parent:
- 1:47973f27d645
- Child:
- 3:a703eda2b125
--- a/main.cpp Fri Aug 14 13:32:24 2015 +0000
+++ b/main.cpp Fri Aug 14 13:56:10 2015 +0000
@@ -10,35 +10,27 @@
#define LA4 440
#define SI4 494
-//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)
+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)
Speaker speaker (PTA4);
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
int freq =0;
-bool activeNotes[7];
int main(){
led1=1;
led2=1;
led3=1;
- Button a (PTA1, LA4, &activeNotes[5], &led1);
- Button b (PTA2, DO4, &activeNotes[0], &led2);
- Button c (PTA12, FA4, &activeNotes[3], &led3);
- //lcd.cls();
+ Button a (PTA1, LA4, &freq, &led1);
+ Button b (PTA2, DO4, &freq, &led2);
+ Button c (PTA12, FA4, &freq, &led3);
+ lcd.cls();
while (true){
- freq=0;
- if(activeNotes[0])
- freq+=FA4;
- if(activeNotes[3])
- freq+=DO4;
- if(activeNotes[5])
- freq+=LA4;
if(freq>0){
speaker.PlayNote(freq, 0.005, 0.2);
- //lcd.printf("%d", freq);
- //wait(0.1);
- //lcd.cls();
}
+ /* lcd.printf("%d", freq);
+ wait(0.1);
+ lcd.cls(); */
}
}
\ No newline at end of file
