*******

encorder.cpp

Committer:
satoyuki1111
Date:
2016-08-15
Revision:
0:ccb4d79a2cf7

File content as of revision 0:ccb4d79a2cf7:

#include "encorder.h"
#include "mbed.h"

Potentiometer::Potentiometer(PinName analog_) : analog(analog_)
{}
float Potentiometer::get_value()
{
    return float(analog.read());
}
int Potentiometer::get_angle()
{
    return (int)(get_value() * 3600);
}
int Potentiometer::get_Rotation()
{
    return (int)Rotation;
}
int Potentiometer::get_angle2()
{
    Value = get_value()*10;
    Rotation  = Value;
    return (int)((Value - Rotation)*360);
}