![](/media/cache/profiles/004acbc8eefec9fe0629b15f52b94bcf.50x50_q85.jpg)
Peter's version
Fork of ScoreCount by
Diff: process_signal.cpp
- Revision:
- 3:8e42915e7375
- Child:
- 6:e269f6c282bc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/process_signal.cpp Thu May 02 13:35:41 2013 +0000 @@ -0,0 +1,57 @@ +#include "mbed.h" + +//Function needs "signal" input, will register hit and add to array + +void reset_array(void) + { + + extern char data[4]; + + //Reset hits from each player + data[0]=0; + data[1]=0; + data[2]=0; + data[3]=0; + } + +unsigned char process_signal(int signal) + { + unsigned char x; + extern unsigned char Ah; + extern unsigned char Bh; + extern unsigned char Ch; + extern unsigned char Dh; + extern char data[4]; + + if (signal==1) + { + Ah++; + data[0]=Ah; + } + + if (signal==2) + { + Bh++; + data[1]=Bh; + } + + if (signal==3) + { + Ch++; + data[2]=Ch; + } + + if (signal==4) + { + Dh++; + data[3]=Dh; + } + + if (signal!=(1 || 2 || 3 || 4)) + { x=0; } + + else + { x=1; } + + return x; + }