forked from yohendry/arduino_L298N
-
Notifications
You must be signed in to change notification settings - Fork 0
/
L298N.h
36 lines (33 loc) · 903 Bytes
/
L298N.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
L298N.h - Library for L298N motor driver
Created by Yohendry Hurtado, 28 dec 2014
Released into the public domain.
*/
#ifndef L298N_h
#define L298N_h
#include "Arduino.h"
class L298N
{
public:
static const int MOTOR_A = 0;
static const int MOTOR_B = 1;
L298N(int ena, int in1, int in2, int in3, int in4, int enb);
void drive_motors(int speed);
void drive_motor(int motor_index, int speed);
void setup_motors(int state1, int state2, int state3, int state4);
void setup_motor(int motor_index, int state1, int state2);
void forward(int speed, int delay_time);
void full_stop(int delay_time);
void turn_right(int speed, int delay_time);
void turn_left(int speed, int delay_time);
void backward(int speed, int delay_time);
private:
struct Motor;
int _ena;
int _in1;
int _in2;
int _in3;
int _in4;
int _enb;
};
#endif