2018 HongoMechaTech A

Dependencies:   mbed

lib/LinearFunction.h

Committer:
Komazawa_sun
Date:
2018-09-18
Revision:
0:e83b840a5f86

File content as of revision 0:e83b840a5f86:

#ifndef LINER_FUNCTION_H_
#define LINER_FUNCTION_H_

#include "mbed.h"

#define LF_MAX_TIME 1000

class LinearFunction
{
public:
    LinearFunction(unsigned int op_period_ms);
    void set(const double val, const double intercept, const unsigned int ct_ms);
    void reset();
    double get_val();
private:
    double _op_period;
    //double _val;
    double _range;
    double _intercept;
    double _ct_s;
    double _current_val;
    
    Ticker _ticker;
    Timer _timer;
    
    void _on_operate();
};

#endif