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 CubicSpline
main.cpp
00001 #include "mbed.h" 00002 #include "CubicSpline.h" 00003 DigitalOut myled(LED1); 00004 CubicSpline2d sensor(5,AsDEBUG); 00005 extern Serial g_Serial_Signal; 00006 extern AnalogIn g_Sensor_Voltage; 00007 00008 int main() 00009 { 00010 double x,y; 00011 Timer t; 00012 myled = 1; 00013 printf("c or l>"); 00014 if(g_Serial_Signal.getc() == 'c') { 00015 sensor.calibrateSensor(); 00016 sensor.printOutData(); 00017 sensor.saveSetting(); 00018 } else { 00019 sensor.loadSetting(); 00020 printf("press any key"); 00021 g_Serial_Signal.getc(); 00022 sensor.printOutData(); 00023 } 00024 myled = 0; 00025 00026 while(1) { 00027 myled = 1; 00028 if(g_Serial_Signal.readable()) { 00029 g_Serial_Signal.getc(); 00030 y = g_Sensor_Voltage.read(); 00031 t.start(); 00032 x = sensor.getX(y); 00033 t.stop(); 00034 printf("y: %f -> x: %f (time: %f)\n",y, x , t.read()); 00035 t.reset(); 00036 myled = 0; 00037 wait(0.2); 00038 } 00039 } 00040 }
Generated on Thu Aug 4 2022 21:44:31 by
1.7.2