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
- Committer:
- margadon
- Date:
- 2014-12-30
- Revision:
- 1:9685565fd3cc
- Parent:
- 0:c2d1ad5059da
File content as of revision 1:9685565fd3cc:
#include "mbed.h"
#include "smooth.cpp"
AnalogIn analog_value(PA_0);
Serial pc(PA_11, PA_12);/* Serial6 tx rx */
DigitalOut myled(LED1);
// Calculate the corresponding acquisition measure for a given value in mV
#define MV(x) ((0xFFF*x)/3300)
uint16_t pre_val;
int main() {
while(1) {
//pc.printf("POPIZDOVALI\r\n");
uint16_t meas = analog_value.read_u16(); // Converts and read the analog input value
if (meas > MV(1000)) { // If the value is greater than 1000 mV toggle the LED
myled = !myled;
}
wait(0.8); // 200 mssdfg
//char c = pc.getc();
//if(c!='q')
uint16_t val = 2;//meas/16;
uint16_t pre_val = 3;//meas/16;
//smooth(&val,&pre_val,3,5);
int ert = &val;
int ert2 = &pre_val;
smooth(ert,ert2,3,5);
pc.printf("value %f - %d\r\n",meas/0xFFFF*3.30000,meas/16);
}
}