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:
- 0:d00bd73d08f8
- Child:
- 1:eb4ee5706587
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GoalCounter.h Sat Jan 12 18:57:26 2019 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +class GoalCounter { +public: + GoalCounter(PinName pin1, PinName pin2); + void tstart1(); + void tstop1(); + void tstart2(); + void tstop2(); + 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; + + +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; + +}; +