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: main.cpp
- Revision:
- 11:09317efe9bb5
- Parent:
- 9:b9ac1d914762
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 06 03:46:20 2017 +0000
@@ -0,0 +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);
+ }
+}
