Index: branch/diagne/Emb_App.tws
===================================================================
--- branch/diagne/Emb_App.tws	(revision 419)
+++ branch/diagne/Emb_App.tws	(revision 420)
@@ -14,8 +14,8 @@
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\conf_noyau.cfg" 25 25 1054 351 0 1 
-"E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\crt0mr.a30" -8 -30 1061 539 1 2 
-"E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\programme_principal_etud.c" 0 0 1061 539 0 0 
+"E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\crt0mr.a30" 0 0 1061 539 0 2 
+"E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1061 539 1 0 
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\bsp\periph.c" 25 25 895 351 0 4 
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\bsp\uart0.c" 0 0 895 351 0 3 
 [LOADED_PROJECTS]
Index: branch/diagne/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/diagne/Emb_App/SessionM32C_E8a_system.hsf	(revision 419)
+++ branch/diagne/Emb_App/SessionM32C_E8a_system.hsf	(revision 420)
@@ -149,7 +149,7 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0016" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0014" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000700" 
@@ -215,7 +215,9 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "capt, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "5" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "piste, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "6" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -321,7 +323,7 @@
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_diagne\tp_info6\tp_info6\bsp\uart0.c" 
-"E:\tp_info6_2018_diagne\tp_info6\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_diagne\tp_info6\tp_info6\bsp\periph.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -368,5 +370,5 @@
 [FLASH_DETAILS]
 "" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
 [BREAKPOINTS]
-"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100013840 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100357456 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/diagne/Emb_App/programme_principal_etud.c
===================================================================
--- branch/diagne/Emb_App/programme_principal_etud.c	(revision 419)
+++ branch/diagne/Emb_App/programme_principal_etud.c	(revision 420)
@@ -211,74 +211,125 @@
 			
 			comm.data.id='D'; //commande angle des roues
 			comm.data.rtr=0;
-			//Pour la piste verte: comm.data.val= -(450-distance)
-	 		
-			//Pour eviter les trous de la piste bleue et garder le vehicule au milieu de la piste
 			
-			if (piste==0x0007)
+			if (piste==0x001) //piste verte
 			{
+				comm.data.val=-(450-distance);
+				snd_dtq(CanTx,comm.msg);
+				dly_tsk(10);
+			}
+		
+			
+			 else if (piste==0x002) //piste bleue
+			{
+				if (distance >1000) new_distance=707;
+				else new_distance=distance;
+				comm.data.val=1*(new_distance-707);
+				snd_dtq(CanTx,comm.msg);
+			
+			dly_tsk(10);
+			}	
 				
-				if(capt==0x7604){
 				
-				comm.data.val=0;
-				snd_dtq(CanTx,comm.msg);
+		else if (piste==0x0003) //piste rouge
+		 	{	
+				if(capt==0x7604)
+				{
+					comm.data.val=0;
+					snd_dtq(CanTx,comm.msg);
 				}
-				else{
-						
-					if (distance >1000)//On compare la distance mesurée par le telemtetre
-						
-					{						
-							new_distance=710;
-							
-					}
-					
-					else new_distance=distance;
-						comm.data.val=1*(new_distance-710); //	On la garde bien au milieu de la piste
-						snd_dtq(CanTx,comm.msg);}
-					   	dly_tsk(10);
-					}
-		else
-		{
-			comm.data.val=(450-distance);
-			snd_dtq(CanTx,comm.msg);
-		}
-
-			
+				else 
+					{
+						if (distance >1000)//On compare la distance mesurée par le telemtetre		
+							new_distance=680;
+						else new_distance=distance;
+						comm.data.val=1*(new_distance-680); //	On la garde bien au milieu de la piste	
+						snd_dtq(CanTx,comm.msg);
+					}				
+					dly_tsk(10);
+								
+				}
 }
 }
 
+
 	
 void Avancer(){
 	dly_tsk(6000);
 	while(1)
-	{ if (piste==0x0007)
-		{
-			CanFrame req;
+	{ 		CanFrame req;
 			req.data.id='V';
 			req.data.rtr=0;
-			if (capt==0x7604)
+			
+			switch (piste)
+			
 			{
- 				req.data.val=45;
+				case 0x001:
+				req.data.val=30;
 				snd_dtq(CanTx,req.msg);
-			}
-			else{	
-				if (capt==0x4203)
+				break;
+				
+				 case  0x002:
+				 req.data.val=19;
+				 snd_dtq(CanTx,req.msg);
+				 break;
+				 
+				case 0x0003:
+			   	if (capt==0x7604)
 				{
- 				req.data.val=7;
-				snd_dtq(CanTx,req.msg);
-				}	
-				else
-				{		
-				req.data.val=30;
-				snd_dtq(CanTx,req.msg);
+ 					req.data.val=45;
+					snd_dtq(CanTx,req.msg);
 				}
+				else{	
+					if (capt==0x4203)
+					{
+ 					req.data.val=5;
+					snd_dtq(CanTx,req.msg);
+					}	
+					else
+					{		
+					req.data.val=30;
+					snd_dtq(CanTx,req.msg);
+					}
+				}
+				break;
 			}
-		}
-	
 		
-} }
+	}	
+} 
 
+void clavier()	
+{
+	char sequence[10]={0};
+	short code_touche;
+    int index = 1;
+        while(1)	
+        {
+         	vrcv_dtq(QdmTouche, &code_touche);
+            lcd_putc(code_touche);
+                while(code_touche != '*')
+           		{                
+                  	if(code_touche == '#')
+                    {
+                     	sequence[0] = code_touche;	
+                    }	
+                    else
+					{
+                    	sequence[index] = code_touche;
+                        index++;
+                     }
+                     vrcv_dtq(QdmTouche, &code_touche);
+                     lcd_putc(code_touche);
+                }
+        sequence[index] = '*';
+        //consigne_tour = decode_int(sequence);
+        index=1;
+        dly_tsk(200);
+        }
+}
 	
+
+	
 void main()
 {
 	CanFrame req,reponse,comm;
@@ -304,6 +355,7 @@
 	sta_tsk(ID_roue);
 	sta_tsk(ID_capteur);
 	sta_tsk(ID_piste);
+	
 //	sta_tsk(ID_roue_rouge);
 	
     while(1)
