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
GoalCounter.h@0:d00bd73d08f8, 2019-01-12 (annotated)
- Committer:
- nxf46245
- Date:
- Sat Jan 12 18:57:26 2019 +0000
- Revision:
- 0:d00bd73d08f8
- Child:
- 1:eb4ee5706587
First commit to GoalCounter library, still not a production version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nxf46245 | 0:d00bd73d08f8 | 1 | #include "mbed.h" |
nxf46245 | 0:d00bd73d08f8 | 2 | |
nxf46245 | 0:d00bd73d08f8 | 3 | class GoalCounter { |
nxf46245 | 0:d00bd73d08f8 | 4 | public: |
nxf46245 | 0:d00bd73d08f8 | 5 | GoalCounter(PinName pin1, PinName pin2); |
nxf46245 | 0:d00bd73d08f8 | 6 | void tstart1(); |
nxf46245 | 0:d00bd73d08f8 | 7 | void tstop1(); |
nxf46245 | 0:d00bd73d08f8 | 8 | void tstart2(); |
nxf46245 | 0:d00bd73d08f8 | 9 | void tstop2(); |
nxf46245 | 0:d00bd73d08f8 | 10 | uint8_t get_score(); |
nxf46245 | 0:d00bd73d08f8 | 11 | float get_balltime(uint8_t score); |
nxf46245 | 0:d00bd73d08f8 | 12 | float get_balltime(); |
nxf46245 | 0:d00bd73d08f8 | 13 | float get_ballspeed(uint8_t score); |
nxf46245 | 0:d00bd73d08f8 | 14 | float get_ballspeed(); |
nxf46245 | 0:d00bd73d08f8 | 15 | uint8_t is_goal1; |
nxf46245 | 0:d00bd73d08f8 | 16 | uint8_t is_goal2; |
nxf46245 | 0:d00bd73d08f8 | 17 | |
nxf46245 | 0:d00bd73d08f8 | 18 | |
nxf46245 | 0:d00bd73d08f8 | 19 | private: |
nxf46245 | 0:d00bd73d08f8 | 20 | InterruptIn _interrupt1; |
nxf46245 | 0:d00bd73d08f8 | 21 | // InterruptIn _interrupt2; |
nxf46245 | 0:d00bd73d08f8 | 22 | volatile uint8_t _score1; |
nxf46245 | 0:d00bd73d08f8 | 23 | volatile uint8_t _score2; |
nxf46245 | 0:d00bd73d08f8 | 24 | Timer t1; |
nxf46245 | 0:d00bd73d08f8 | 25 | Timer t2; |
nxf46245 | 0:d00bd73d08f8 | 26 | float _balltimes1[11]; |
nxf46245 | 0:d00bd73d08f8 | 27 | float _time1; |
nxf46245 | 0:d00bd73d08f8 | 28 | float _balltimes2[11]; |
nxf46245 | 0:d00bd73d08f8 | 29 | float _time2; |
nxf46245 | 0:d00bd73d08f8 | 30 | |
nxf46245 | 0:d00bd73d08f8 | 31 | }; |
nxf46245 | 0:d00bd73d08f8 | 32 |