oussama oueslati / Mbed 2 deprecated Code_Finale_Servo_C1

Dependencies:   mbed

Fork of Code_Finale_Servo_C1 by wassim boumaiza

Files at this revision

API Documentation at this revision

Comitter:
oussamapay
Date:
Sat Apr 16 16:17:31 2016 +0000
Parent:
2:b6821dcf9176
Commit message:
uhu

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Apr 16 14:03:29 2016 +0000
+++ b/main.cpp	Sat Apr 16 16:17:31 2016 +0000
@@ -15,9 +15,9 @@
 // Pince cone droite 
 PwmOut PWM6(PB_0);
 
-//PwmOut PWM7(PB_7);   //Pince Glissement droite
+PwmOut PWM7(PA_2);   //Pince Glissement droite
 
-//PwmOut PWM8(PB_6);//Pince cone gauche
+PwmOut PWM8(PA_3);//Pince cone gauche
 
 
 
@@ -47,8 +47,8 @@
 
 void Pince_Glissement_Droit(int a)
 {//0arriere 50 avant
-//PWM7.period_ms(20); 
-//PWM7.write(map (a,0,180,0.028f,0.12f));   
+PWM7.period_ms(20); 
+PWM7.write(map (a,0,180,0.028f,0.12f));   
 }
 void Pince_Cone_Droite(int a)
 {//10 fermeture 60 ouverture
@@ -58,8 +58,8 @@
     
 void Pince_Cone_Gauche(int a)
 {//10 ouverture 50 fermeture
-//PWM8.period_ms(20); 
-//PWM8.write(map (a,0,180,0.028f,0.12f));
+PWM8.period_ms(20); 
+PWM8.write(map (a,0,180,0.028f,0.12f));
         }
         
 void Monte_Charge(int a)
@@ -88,8 +88,8 @@
     }
     
 void Fermeture_Cone()
-{Pince_Cone_Droite(10);
-Pince_Cone_Gauche(55);
+{Pince_Cone_Droite(5);
+Pince_Cone_Gauche(50);
     }
 void Up_Charge()
 {Monte_Charge(65);
@@ -112,26 +112,51 @@
 
 
 int main() 
-{int a=0;
-SPINUCLEO.frequency(21000000);  
+{//uint8_t a=0;
+while(1){
+Pince_Bas_Gauche(30);
+wait(1);
+Pince_Bas_Gauche(0);
+wait(1);}}
+/*SPINUCLEO.frequency(21000000);  
 SPINUCLEO.reply(0x00);
 while(1)
 {
     
 if (SPINUCLEO.receive())
 {
-a=SPINUCLEO.read(); 
+    a=SPINUCLEO.read();
+    SPINUCLEO.reply(a);
+    if(a==0x0A)
+    {
+     
 led = 1; // LED is ON
-wait(0.250); // 250 ms
- Down_Charge();
+wait(0.250); // 250
+while(1)
+{
+    Pince_avant();
+    wait(1);
+    Ouverture_pince();
+    wait(1);
+    Fermeture_pince();
+    wait(1);
+    Pince_arriere();
+    wait(1);
+    Ouverture_Cone();
+    wait(1);
+    Fermeture_Cone();
+    wait(1);
+    Down_Charge();
     wait(1);
     Up_Charge();
     wait(1);
+ }   
+    } 
 led = 0; // LED is OFF
 wait(0.250); // 250 ms
- 
+}
 }
-}}
+}
 
 /*
   while(1)