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

Committer:
nxf46245
Date:
2019-01-12
Revision:
0:d00bd73d08f8
Child:
1:eb4ee5706587

File content as of revision 0:d00bd73d08f8:

#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; 
      
};