han back / Mbed OS CLEO_SOUND
Committer:
SMART_CLEO
Date:
Thu Sep 28 03:27:05 2017 +0000
Revision:
0:25a48958f7b8
SMART_CLEO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SMART_CLEO 0:25a48958f7b8 1 #include "mbed.h"
SMART_CLEO 0:25a48958f7b8 2 #include "TextLCD.h"
SMART_CLEO 0:25a48958f7b8 3
SMART_CLEO 0:25a48958f7b8 4 PinName pin_SOUND = PC_3;
SMART_CLEO 0:25a48958f7b8 5
SMART_CLEO 0:25a48958f7b8 6 AnalogIn adc_SOUND(pin_SOUND);
SMART_CLEO 0:25a48958f7b8 7
SMART_CLEO 0:25a48958f7b8 8 // rs, rw, e, d0-d3
SMART_CLEO 0:25a48958f7b8 9 TextLCD lcd(PB_12, PB_13, PB_14, PB_15, PA_9, PA_10, PA_11);
SMART_CLEO 0:25a48958f7b8 10
SMART_CLEO 0:25a48958f7b8 11 int main() {
SMART_CLEO 0:25a48958f7b8 12
SMART_CLEO 0:25a48958f7b8 13 int volt;
SMART_CLEO 0:25a48958f7b8 14 lcd.printf(" SOUND Program\n");
SMART_CLEO 0:25a48958f7b8 15 lcd.printf(" Volt : [mV]");
SMART_CLEO 0:25a48958f7b8 16 while(1) {
SMART_CLEO 0:25a48958f7b8 17 volt = adc_SOUND.read()*3300;
SMART_CLEO 0:25a48958f7b8 18 lcd.locate(8, 1);
SMART_CLEO 0:25a48958f7b8 19 lcd.printf("%4d", volt);
SMART_CLEO 0:25a48958f7b8 20 wait(0.5);
SMART_CLEO 0:25a48958f7b8 21 }
SMART_CLEO 0:25a48958f7b8 22 }