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.
main.cpp
00001 #include "mbed.h" 00002 #include "BMP085.h" 00003 #include "uLCD_4DGL.h" 00004 #include "statistics.h" 00005 #include "spikes.h" 00006 00007 #define SHORT_SAMPLE 5 00008 #define LONG_SAMPLE 20 00009 00010 BMP085 barometer(p9, p10); 00011 uLCD_4DGL uLCD(p28, p27, p29); 00012 AnalogIn ain(p17); 00013 Ticker ticker; 00014 //SpikeFinder s = SpikeFinder(30, 6, 4.0); 00015 // For wind sensor: 00016 //SpikeFinder s = SpikeFinder(40, 10, 7.0); 00017 // For pressure sensor: 00018 SpikeFinder s = SpikeFinder(4, 4, 3.0); 00019 00020 void tick() { 00021 __disable_irq(); 00022 barometer.update(); 00023 s.addSample(barometer.get_pressure()); 00024 __enable_irq(); 00025 } 00026 00027 int main() { 00028 while(1) { 00029 //ticker.attach(&tick, 0.04); 00030 ticker.attach(&tick, .1); 00031 wait(1); 00032 float f = ain; 00033 uLCD.printf("Low: %s, High : %s\n", s.lowSpikeFound() ? "true":"false", s.highSpikeFound() ? "true":"false"); 00034 wait(1); 00035 uLCD.printf("Low: %s, High : %s\n", s.lowSpikeFound() ? "true":"false", s.highSpikeFound() ? "true":"false"); 00036 wait(1); 00037 ticker.detach(); 00038 s.reset(); 00039 wait(1); 00040 uLCD.cls(); 00041 } 00042 return 0; 00043 } 00044
Generated on Thu Jul 14 2022 00:32:06 by
1.7.2