Updated
Dependencies: C12832 LM75B PWM_Tone_Library mbed
Fork of IoT Project Final by
Diff: main.cpp
- Revision:
- 1:1ed4e4239ea6
- Parent:
- 0:e9258aa72a94
- Child:
- 2:c8d16cec2564
--- a/main.cpp Wed Feb 22 09:52:16 2017 +0000 +++ b/main.cpp Wed Feb 22 10:11:48 2017 +0000 @@ -5,7 +5,9 @@ //DigitalOut myled(LED1); PwmOut Buzzer(D5); C12832 lcd(p5, p7, p6, p8, p11); -AnalogIn sensor(p15); +AnalogIn sensor(p15); +PwmOut spkr(p26); +BusOut RGB (p23, p24, p25); float C_3 = 1000000/Do3, Cs_3 = 1000000/Do3s, @@ -51,13 +53,26 @@ float multiplier = 50; // this number got me closest to the reading on my multimeter temp probe float temp; // calculated temperature -int count = 0; // for computing average reading -float total = 0; +int count; // for computing average reading +float total; float average; -float thermo() { -// count = 0; -// total = 0.0; +void buzz() +{ + for (float i=2000.0; i<10000.0; i+=100) { + spkr.period(1.0/i); + spkr=0.5; + wait(0.1); + } + spkr=0.0; +} + +int main() { + count = 0; + total = 0.0; + RGB = 0xFF; + buzz(); + while (1) { // formula is analog reading * multiplier @@ -91,19 +106,7 @@ // //} -DigitalIn fire(p14); -PwmOut spkr(p26); + -int main() -{ - while (1) { - for (float i=2000.0; i<10000.0; i+=100) { - spkr.period(1.0/i); - spkr=0.5; - wait(0.1); - } - spkr=0.0; - while(!fire) {} - } -} +