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
Revision 1:80aff65f39db, committed 2017-04-02
- Comitter:
- bbi22
- Date:
- Sun Apr 02 01:30:25 2017 +0000
- Parent:
- 0:91510972cdaf
- Child:
- 2:fd2ba0d14fdb
- Commit message:
- Coefficient n?gatif
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 01 17:06:06 2017 +0000 +++ b/main.cpp Sun Apr 02 01:30:25 2017 +0000 @@ -1,29 +1,26 @@ #include "mbed.h" Serial pc(USBTX, USBRX); +AnalogIn input(p20); -float const N = 6; -float const a[N] = { +float const N = 6; // Nombre de coefficient +float const a[6] = { // Coefficients 48.0, 39.747873330026010307847172953188, - 193.17329895624212099392025265843, + -193.17329895624212099392025265843, 446.63538359883938255734392441809, - 466.0247897041737132894922979176, + -466.0247897041737132894922979176, 179.60194249453365955560002475977 }; -AnalogIn input(p20); - -DigitalOut myled(LED1); - int main() { - while(1) { + while(true) { float x = 1; float v = input; float h = a[0]; for(int power = 1; power < N; power++) { - x *= v; + x *= v; // x = v^power h += a[power] * x; }