Files
ENIG/Arduino_PLC/motor.h
2025-01-07 16:07:58 +09:00

53 lines
997 B
C++

#ifndef _MOTOR_H_
#define _MOTOR_H_
#include "arduino.h"
#include "VarClass.h"
enum ZRunMode
{
ZRUN_STOP = 0,
ZRUN_UP,
ZRUN_DN
};
enum ZDirection
{
ZDIR_CW = 0,
ZDIR_CCW
};
class motor {
public:
void Setup();
void Update();
void SetSpeedZ(uint8_t value);
ZDirection GetZDirL(); //Z축 진행방향을 표시합니다. True 일경우, 정방향(위로), False일경우 역방향(아래로)
ZDirection GetZDirR(); //Z축 진행방향을 표시합니다. True 일경우, 정방향(위로), False일경우 역방향(아래로)
void SetZDir(ZDirection direction); //1=정방향, 0=역방향
void SetZRun(ZRunMode run);
void SetZRunL(bool run);
void SetZRunR(bool run);
bool IsMoveZ(); //현재 이동중인가?
private:
void SetPowerL(bool on);
void SetPowerR(bool on);
bool IsMoveZL();
bool IsMoveZR();
void ZLimit_AutoStop(); //Z축 리밋센서에 의한 동작 정지
};
extern motor mot;
#endif