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: MMA8451Q mbed xbee_lib
Fork of Programme_course by
shield.cpp
00001 #include "Mlib.h" 00002 00003 /***************SHIELD*****************/ 00004 00005 00006 void moteurs_arriere() 00007 { 00008 vitesse_virage = new_bari/2; 00009 00010 ajust_vitesse = ajust_vit_bosse +((ligne_droite*5)/2); 00011 00012 pc.printf("%hi\n", ajust_vit_bosse); 00013 00014 while(bosse==1) {PWM_motor(90,90);} // acceleration à diminuer pour la competition 00015 00016 while(bosse==3) {PWM_motor(30,30);} 00017 00018 if(VIT == 0) 00019 { 00020 PWM_motor(0,0); 00021 } 00022 else if(ralentire == 1) 00023 { 00024 if(vitesse_virage > 0) 00025 { 00026 PWM_motor((VIT+ajust_vitesse) - vitesse_virage,(VIT+ajust_vitesse)+ 4*vitesse_virage); // ajust_vitesse seulemnt sur le moteur gauche????? 00027 } 00028 else 00029 { 00030 PWM_motor((VIT+ajust_vitesse)- 4*vitesse_virage, (VIT+ajust_vitesse) + vitesse_virage); 00031 } 00032 } 00033 else 00034 { 00035 PWM_motor((VIT+ajust_vitesse)- vitesse_virage, (VIT+ajust_vitesse) + vitesse_virage); 00036 00037 } 00038 00039 } 00040 00041 void test_servo(int time) 00042 { 00043 Timer debut_fct; 00044 debut_fct.start(); 00045 while(debut_fct.read() < time) 00046 { 00047 for(int i = -30; i < 30; i++) 00048 { 00049 angle_servo_moteur(i); 00050 wait(0.01); 00051 } 00052 for(int i = 30; i > -30; i--) 00053 { 00054 angle_servo_moteur(i); 00055 wait(0.01); 00056 } 00057 } 00058 angle_servo_moteur(0); 00059 } 00060 00061 void Get_pot_value() 00062 { 00063 VIT = 0, KP = 0; 00064 for(int i = 0; i < 10; i++) 00065 { 00066 //VIT += ((pot1.read()+1)*(25.0)); 00067 KP += ((pot2.read()+1)*100); 00068 } 00069 //VIT /= 10; 00070 // pc.printf("VIT=%d\nKP=%d\n",VIT,KP); 00071 } 00072
Generated on Tue Jul 12 2022 21:30:22 by
