-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeerBotCtrl.h
68 lines (55 loc) · 1.22 KB
/
BeerBotCtrl.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// BeerBotCtrl.h
#ifndef _BEERBOTCTRL_h
#define _BEERBOTCTRL_h
#include "NewPing.h"
#include "Pins.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
class BeerBot
{
public:
// CONSTRUCTORS
BeerBot();
// MOTOR METHODS
void init();
void setLeftMotor(int speed);
void setRightMotor(int speed);
void setMotors(int leftSpeed, int rightSpeed);
void setLeftBrake(int brake);
void setRightBrake(int brake);
void setBrakes(int leftBrake, int rightBrake);
unsigned int getLMCurrentMilliamps();
unsigned int getRMCurrentMilliamps();
unsigned char getLMFault();
unsigned char getRMFault();
//SONAR
void updateSonarFL();
void updateSonarFML();
void updateSonarFMR();
void updateSonarFR();
void updateSonars();
private:
//MOTOR VARIABLES
unsigned char _INA1;
unsigned char _INB1;
static const unsigned char _PWM1 = 9;
unsigned char _EN1DIAG1;
unsigned char _CS1;
unsigned char _INA2;
unsigned char _INB2;
static const unsigned char _PWM2 = 10;
unsigned char _EN2DIAG2;
unsigned char _CS2;
//SONAR OBJECTS
NewPing SonarFL;
NewPing SonarFR;
NewPing SonarFML;
NewPing SonarFMR;
//SONAR Distance Table
int sonar_distance[4];
};
extern BeerBot BeerBotCtrl;
#endif