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.
Diff: MainEvr.cpp
- Revision:
- 9:b9ac1d914762
- Parent:
- 8:5124be43c963
--- a/MainEvr.cpp Tue Sep 05 10:00:13 2017 +0000 +++ b/MainEvr.cpp Tue Sep 05 10:27:28 2017 +0000 @@ -1,45 +1,45 @@ -//#include "Accelerometre.h" -//#include "Afficheur.h" -// -//Serial pc(USBTX, USBRX); -//int main() { -// -// -// -// Afficheur afficheur; -// Accelerometre acc; -// -// double angle = 0; -// -// while(true){ -// -// acc.readxyzAngle(&angle); -// pc.printf("angle is : %lf\r\n",angle); -// -// -// -// char c1[10]; -// char c2[4]; -// -// sprintf(c1 , "%4f" , angle); -// int virgule; -// int j =0; -// for(int i =0;i<4;i++){ -// if(c1[j] == '.'){ -// virgule = 1 <<j-1; -// i--; -// j++; -// continue; -// } -// c2[i] = c1[j]; -// j++; -// -// } -// -// pc.printf("virg= %d",virgule); -// afficheur.write(c2,4, virgule); -// -// pc.printf("test"); -// wait(0.45); -// } -//} +#include "Accelerometre.h" +#include "Afficheur.h" + +Serial pc(USBTX, USBRX); +int main() { + + + + Afficheur afficheur; + Accelerometre acc; + + double angle = 0; + + while(true){ + + acc.readxyzAngle(&angle); + pc.printf("angle is : %lf\r\n",angle); + + + + char c1[10]; + char c2[4]; + + sprintf(c1 , "%4f" , angle); + int virgule; + int j =0; + for(int i =0;i<4;i++){ + if(c1[j] == '.'){ + virgule = 1 <<j-1; + i--; + j++; + continue; + } + c2[i] = c1[j]; + j++; + + } + + pc.printf("virg= %d",virgule); + afficheur.write(c2,4, virgule); + + pc.printf("test"); + wait(0.45); + } +}