Peter's version

Fork of ScoreCount by George Cochrane

Files at this revision

API Documentation at this revision

Comitter:
gcme93
Date:
Fri May 03 12:07:30 2013 +0000
Parent:
5:a50e02fc49cd
Commit message:
the final copy

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
process_signal.cpp Show annotated file Show diff for this revision Revisions of this file
process_signal.h Show annotated file Show diff for this revision Revisions of this file
reciever.cpp Show annotated file Show diff for this revision Revisions of this file
transmitter.cpp Show diff for this revision Revisions of this file
diff -r a50e02fc49cd -r e269f6c282bc main.cpp
--- a/main.cpp	Thu May 02 21:18:42 2013 +0000
+++ b/main.cpp	Fri May 03 12:07:30 2013 +0000
@@ -3,8 +3,7 @@
 #include "TextLCD.h"
 #include "process_signal.h"
 #include "reciever.h"
-
-
+#include "transmitter.h"
 
 
 //RGB LED SETUP
@@ -12,6 +11,8 @@
 DigitalOut Blue(PTC10);
 DigitalOut Green(PTC11);
 
+Serial pc(USBTX,USBRX);
+
 //LCD SCREEN SETUP
 TextLCD lcd(PTD7, PTD6, PTA17, PTA16, PTC17, PTC16); // rs, e, d4-d7
 
@@ -60,8 +61,7 @@
     signal=Interrogate();
     hit= process_signal(signal);
 
-                if (hit==1)
-                {  
+                 
                 lives--;
                 
                 if(lives<0)
@@ -85,7 +85,7 @@
                     Blue=1;
                     wait(0.2);                  
                     }
-                }
+                
     }
        
 end:
diff -r a50e02fc49cd -r e269f6c282bc process_signal.cpp
--- a/process_signal.cpp	Thu May 02 21:18:42 2013 +0000
+++ b/process_signal.cpp	Fri May 03 12:07:30 2013 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 
+
 //Function needs "signal" input, will register hit and add to array
 
 void reset_array(void)
@@ -14,9 +15,9 @@
     data[3]=0;
     }
 
-unsigned char process_signal(int signal)
+int process_signal(int signal)
         {
-        unsigned char x;
+        int x;
         extern unsigned char Ah;
         extern unsigned char Bh;
         extern unsigned char Ch;
@@ -46,12 +47,8 @@
         Dh++;
         data[3]=Dh;
         }
-       
-       if (signal!=(1 || 2 || 3 || 4))
-       { x=0; }
-       
-       else
-       { x=1; }
+        
+        x=1; 
        
        return x;
        }
diff -r a50e02fc49cd -r e269f6c282bc process_signal.h
--- a/process_signal.h	Thu May 02 21:18:42 2013 +0000
+++ b/process_signal.h	Fri May 03 12:07:30 2013 +0000
@@ -1,2 +1,2 @@
-unsigned char process_signal(int signal);
+int process_signal(int signal);
 void reset_array(void);
\ No newline at end of file
diff -r a50e02fc49cd -r e269f6c282bc reciever.cpp
--- a/reciever.cpp	Thu May 02 21:18:42 2013 +0000
+++ b/reciever.cpp	Fri May 03 12:07:30 2013 +0000
@@ -1,4 +1,4 @@
-#include "mbed.h"
+             #include "mbed.h"
 
 char string[64];
 int p;
@@ -6,6 +6,7 @@
 
 int Interrogate()
 {
+Serial pc(USBTX,USBRX);
 Serial myserial(PTC4,PTC3);
 myserial.baud(1200);
 DigitalOut blueled(LED1);
@@ -21,7 +22,7 @@
              {
              blueled=0;
             myserial.scanf("%s",string);
-                  
+              pc.printf("\n\r%s", string);    
              if((strstr (string,"011")) != NULL)
                {
                  p = 1;
@@ -41,7 +42,8 @@
              for(int f=0;f<5;f++)
              {
              blueled=!blueled;
-             wait(0.2);             
+             wait(0.2);  
+               pc.printf("\n\r%d", p);         
              return p;  
              }                       
              }           
diff -r a50e02fc49cd -r e269f6c282bc transmitter.cpp
--- a/transmitter.cpp	Thu May 02 21:18:42 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#include "mbed.h"
-#include "TSISensor.h"
-
-
-Serial pc(USBTX,USBRX);
-PwmOut clk(PTD4);
-DigitalOut blueled(LED1);
-Serial myserial(PTC4, PTC3);
-
-
-TSISensor tsi;
-
-//PTD4----->|-------PTC4 (serial TX)
-
-char c[4] = "011"; //011 for Team A; 012 for Pack B; 013 for Pack C; 014 for Pack D
-float a;
-char ldriv;
-
-
-char msg[5];
-
-int Fire() 
-{
-
-sprintf(msg,"\r");
-int i=0;
-int j=0;
-ldriv=1;
-myserial.baud(1200);
-clk.period(26e-6);
-clk=0.5;
-    while(1)
-    {
-      blueled = 1;
-      a = tsi.readPercentage();
-      if(a>0.1)
-      {
-      for(j = 0; j < 5; j++)
-         {
-           blueled = 0;
-           i=(i+1) % 3;
-           myserial.putc(c[i]);
-           if(i==0) 
-             {
-               ldriv=0;
-               wait(0.1);
-               ldriv=1;
-             }
-         }
-         myserial.putc(msg[0]);   
-       blueled = 1;  
-       while(tsi.readPercentage() > 0.1){}
-      }
-    }
-}