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.
Revision 0:e2decaadef56, committed 2021-06-10
- Comitter:
- lafritedavid
- Date:
- Thu Jun 10 12:15:27 2021 +0000
- Commit message:
- test
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 10 12:15:27 2021 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +Serial pc ( USBTX, USBRX ); +AnalogIn pot(PA_0); // potentiometre dans l'aile +AnalogIn pot1(PA_1); // potentiometre de test + + +DigitalOut MoteurIN1(PB_0); // rotation anti horaire (-20°) fil vert PB0 +DigitalOut MoteurIN2(PC_1); // rotation horaire (+20°) fil blanc PC1 +int main() +{ + + float MesureAngle; // mesure du potentiometre dans l'aile + float ConsigneAngle; //= 0.47; // valeur entre 0,44 et 0,56 // consigne en pourcentage ou degré + + MoteurIN1.write(0); + MoteurIN2.write(0); + + + + while(1) { + + MesureAngle = (pot.read()*-333)+166; // mesure d'angle en degré + ConsigneAngle = pot1.read()*40-20; // consigne anngle de -20 a +20 degré + + + pc.printf("Consigne %f Mesure %f \n\r",ConsigneAngle,MesureAngle); + + + + if ((ConsigneAngle-MesureAngle)>1) { + MoteurIN1.write(0); + MoteurIN2.write(1); + pc.printf("Sens 1\r\n"); + } + else if ((ConsigneAngle-MesureAngle)<-1){ + pc.printf("Sens 2\r\n"); + MoteurIN1.write(1); + MoteurIN2.write(0); + } + else { + MoteurIN1.write(0); + MoteurIN2.write(0); + } + wait(0.1); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jun 10 12:15:27 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file