Grenade Drone Controller

Dependencies:   mbed

Revision:
1:903bcc4d9628
Parent:
0:4194aba3f887
--- a/GranadeCtrl.cpp	Mon Jul 16 06:49:15 2018 +0000
+++ b/GranadeCtrl.cpp	Mon Aug 20 03:06:52 2018 +0000
@@ -3,21 +3,29 @@
 #include "GlobalVars.h"
 #include "Functions.h"
 
-bool fSndTimer=0;
+bool fSndTimer=1;
+bool fDebugTimer=1;
 
 Timeout SndTimer;
+Ticker DebugTimer;
 void SndTimer_isr(void) {fSndTimer=1;}
+void DebugTimer_isr(void) {fDebugTimer=1;}
 
 int main() 
 {
-    SndTimer.attach(&SndTimer_isr,1);
-    InitPWM();
-    
     pc.baud(115200);
     Switch.baud(9600);
     
+    InitPWM();
+    
+    pc.printf("Start\n");
+    
+    DebugTimer.attach(&DebugTimer_isr,1);
+    
     while(1) 
-    {
+    {   
+        if(Switch.readable()) RcvProc();
+        
         if(fSndTimer==1)
         {
             fSndTimer=0;
@@ -26,8 +34,15 @@
             SigBit=RcvBit;
             Switch.putc(SigBit);
             
+            SndTimer.attach(&SndTimer_isr,0.02);            
         }
         
-        if(Switch.readable()) RcvProc();
+        if(fDebugTimer==1)
+        {
+            fDebugTimer=0;
+            pc.printf("%d %d %d %d %d %d %d %d\n",(int)var1,(int)var2,(int)var3,(int)var4,(int)var5,(int)var6,(int)var7,(int)var8);
+        }
+        
+        
     }
 }