This library provides simple interface for the table football goal counter based on a IR LED or laser diode and phototransistor.
Dependents: goal_counter_project
Diff: GoalCounter.h
- Revision:
- 1:eb4ee5706587
- Parent:
- 0:d00bd73d08f8
- Child:
- 3:ce69ad70270a
--- a/GoalCounter.h Sat Jan 12 18:57:26 2019 +0000 +++ b/GoalCounter.h Sun Jan 13 14:23:14 2019 +0000 @@ -1,32 +1,27 @@ +#ifndef GOALCOUNTER_H +#define GOALCOUNTER_H + #include "mbed.h" class GoalCounter { public: - GoalCounter(PinName pin1, PinName pin2); - void tstart1(); - void tstop1(); - void tstart2(); - void tstop2(); + GoalCounter(PinName pin, Timer * t); + void tstart(); + void tstop(); uint8_t get_score(); float get_balltime(uint8_t score); float get_balltime(); float get_ballspeed(uint8_t score); float get_ballspeed(); - uint8_t is_goal1; - uint8_t is_goal2; - + volatile uint8_t is_goal; private: - InterruptIn _interrupt1; -// InterruptIn _interrupt2; - volatile uint8_t _score1; - volatile uint8_t _score2; - Timer t1; - Timer t2; - float _balltimes1[11]; - float _time1; - float _balltimes2[11]; - float _time2; + InterruptIn * _interrupt; + volatile uint8_t _score; + Timer * _t; + float _balltimes[11]; + float _time; }; +#endif \ No newline at end of file