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.
Direction.cpp
00001 #include "Direction.h" 00002 00003 //INSTANCIATION DES INSTANCES GLOBALES 00004 PwmOut direction(DIR_PIN); 00005 00006 void initDirection() { 00007 direction.period(DIR_PERIOD); 00008 setDirection(128); 00009 } 00010 00011 /*en float : ~0.025 -> roues braquées a gauche 00012 ~0.08 -> roues braquées a droite 00013 en int : 0 -> gauche 00014 256 -> droite*/ 00015 void setDirection(int dir) { 00016 direction.write(((((float)dir)/256)*0.055f + 0.025f)); 00017 } 00018 00019 00020 void testDirection() { 00021 float vMoteur = 0.0; 00022 for(int i=0;i<256;i++) 00023 { 00024 setDirection(i); 00025 xbee.printf("i = %d ; direction = %f\n",i,direction.read()); 00026 wait(0.1f); 00027 vMoteur = (i-128.0f) / 128.0f; 00028 //setMoteurs(vMoteur,vMoteur); 00029 xbee.printf("vitesse moteurs : %f\n\n",vMoteur); 00030 } 00031 }
Generated on Wed Jul 13 2022 20:35:19 by
1.7.2