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: mbed-dsp
Fork of mbed-os-example-blinky by
main.cpp
- Committer:
- deeza
- Date:
- 2017-03-29
- Revision:
- 46:5ad0d78d045e
- Parent:
- 45:b1b431753adc
- Child:
- 47:b9abb45fde85
File content as of revision 46:5ad0d78d045e:
#include "mbed.h" DigitalOut led1(LED1); // State machine int STATE; const int NONE = -1; const int IDLE_LISTEN = 0; const int CALC_DELTA_T = 1; const int CALC_DELTA_S = 2; const int CALC_DELTA_PHI = 3; const int SEND = 4; const int WAIT = 9; // main() runs in its own thread in the OS int main() { STATE = IDLE_LISTEN; while (true) { switch (STATE) { case IDLE_LISTEN: //code here STATE = CALC_DELTA_T break; case CALC_DELTA_T: //code here break; case CALC_DELTA_S: //code here break; case CALC_DELTA_PHI: // code here break; case SEND: // code here break; } } } //Calculating distanse between sound and camera double calcDis(double t, double v){ double s = t*v; return s; } //Calculating angle in radians, D distanse between mic1 and mic2 double calcAng(double s, double D){ double ang = asin(s/D); return ang; } //Presuming the input value is temp as a nuber and humidity as procent double speedofsound(double temp, double hum){ //Calculations done in Matlab double speed = 331.1190 + 0.6016*temp + 0.0126*hum; return speed; }