SEDO subject project

Dependencies:   ds3231 mbed-rtos mbed DHT

motor_cnt.cpp

Committer:
ValenSalLop
Date:
2017-05-15
Revision:
12:1d544cdab2cf
Parent:
10:f14f47225091

File content as of revision 12:1d544cdab2cf:

#include "mbed.h"
#include "motor_cnt.h"

PwmOut m_speed(D5);
DigitalOut m_direction(D4);
uint8_t speed_current = 0;
uint8_t direction_current = 0;

int set_motor_speed(float speed)
{
    m_speed = speed;
    speed_current = speed;
    return 0;
}
int set_motor_direction(uint8_t direction)
{
    if(direction != 0) {
        m_direction=1;
        direction_current=1;
    } else {
        m_direction=0;
        direction_current=0;
    }
    return 0;
}
int get_motor_speed(void)
{
    return speed_current;
}
int get_motor_direction(void)
{
    return direction_current;
}