ttt

Dependencies:   mbed TrapezoidControl QEI Pulse LM61CIZ

Files at this revision

API Documentation at this revision

Comitter:
kishibekairohan
Date:
Sat Jul 06 07:58:17 2019 +0000
Parent:
16:3f2c2d89372b
Child:
18:c694bae76e51
Commit message:
a;

Changed in this revision

System/Process/Process.cpp Show annotated file Show diff for this revision Revisions of this file
System/Process/Process.h Show annotated file Show diff for this revision Revisions of this file
--- a/System/Process/Process.cpp	Mon Jul 01 13:00:20 2019 +0000
+++ b/System/Process/Process.cpp	Sat Jul 06 07:58:17 2019 +0000
@@ -52,7 +52,6 @@
 Ticker BuzzerTimer;
 bool EMGflag = false;
 PwmOut buzzer(BUZZER_PIN);
-//buzzer.period(1.0/800);
 //**************Buzzer****************
 
 //************TapeLed*****************
@@ -187,6 +186,7 @@
 		//LED_DEBUG0 = !LED_DEBUG0;
 		//LED_DEBUG1 = !LED_DEBUG1;
 		//printf("%d\r\n",ECD_0.getPulses());
+		buzzer.period(1.0/800);
 		
 		#ifdef USE_MU
 		controller = CONTROLLER::Controller::GetData();
@@ -198,8 +198,11 @@
 			CONTROLLER::Controller::DataReset();
 			AllActuatorReset();
 			lock = true;
-			buzzer = 1;
-			BuzzerTimer.attach(BuzzerTimer_func, 0.5);
+			//buzzer = 1;
+			//BuzzerTimer.attach(BuzzerTimer_func, 0.5);
+			//buzzer = 1;
+			//BuzzerTimer.attach(&BuzzerTimer_func, 1.2);
+			//BuzzerTimer.attach(BuzzerTimer_func, 1);
 		}
 		else
 		#endif
@@ -218,18 +221,17 @@
 		}
 		
 		//Emergency!
-		if(EMG_0 || EMG_1){
-			buzzer = 1;
-			BuzzerTimer.attach(BuzzerTimer_func, 1.2);
-			current = 0;
+		if(!EMG_0 && !EMG_1 && !EMGflag){
+			buzzer = 0;
+			BuzzerTimer.attach(BuzzerTimer_func, 1);
+			EMGflag = true;
+			LED_DEBUG0 = 1;
 		}
-		
-		//Safety	
-		if(!EMG_0 && !EMG_1){
-			buzzer = 0;
+		if(EMG_0 && EMG_1 && EMGflag){
+			buzzer = 1;
 			BuzzerTimer.detach();
+			EMGflag = false;
 		}
-		
 		SystemProcessUpdate();
 	}
 }
@@ -329,6 +331,7 @@
 
 void BuzzerTimer_func(){
     buzzer = !buzzer;
+    //LED_DEBUG0 = !LED_DEBUG0;
 }
 
 void TapeLedEms_func() {
--- a/System/Process/Process.h	Mon Jul 01 13:00:20 2019 +0000
+++ b/System/Process/Process.h	Sat Jul 06 07:58:17 2019 +0000
@@ -3,7 +3,7 @@
 
 #include "mbed.h"
 
-#define BUZZER_PIN PC_5
+#define BUZZER_PIN PA_5
 #define EMG_0 LimitSw::IsPressed(0)
 #define EMG_1 LimitSw::IsPressed(1)