|
|
@ -1,6 +1,5 @@ |
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Connects to a PixelHub server, receives commands, and acts upon them. |
|
|
|
/// </summmary> |
|
|
@ -9,14 +8,35 @@ class PixelBotController |
|
|
|
public: |
|
|
|
PixelBotController(); |
|
|
|
~PixelBotController(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const int STOP = 0; |
|
|
|
static const int FORWARDS = 1; |
|
|
|
static const int BACKWARDS = 2; |
|
|
|
static const int LEFT = 3; |
|
|
|
static const int RIGHT = 4; |
|
|
|
|
|
|
|
void MoveDistance(int direction, int ticks); |
|
|
|
void MoveTick(int direction); |
|
|
|
|
|
|
|
unsigned long GetTicksTravelled(); |
|
|
|
|
|
|
|
private: |
|
|
|
int motorLookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001}; |
|
|
|
const int rmotorPin1 = 16; |
|
|
|
const int rmotorPin2 = 5; |
|
|
|
const int rmotorPin3 = 4; |
|
|
|
const int rmotorPin4 = 0; |
|
|
|
|
|
|
|
int motorSpeed = 1200; //variable to set stepper speed |
|
|
|
int count = 0; // count of steps made |
|
|
|
int countsperrev = 512; // number of steps per full revolution |
|
|
|
}; |
|
|
|
const int lmotorPin1 = 2; |
|
|
|
const int lmotorPin2 = 14; |
|
|
|
const int lmotorPin3 = 12; |
|
|
|
const int lmotorPin4 = 13; |
|
|
|
|
|
|
|
int motorLookup[8] = { 0b01000, 0b01100, 0b00100, 0b00110, 0b00010, 0b00011, 0b00001, 0b01001 }; |
|
|
|
|
|
|
|
int motorSpeed = 1200; // The speed at which the stepper motor accepts bits |
|
|
|
unsigned long ticksTravelled = 0; // Number of steps travelled (including turns) |
|
|
|
int ticksPerRevolution = 512; // Number of steps per full revolution of the wheels |
|
|
|
int tickDelay = 1; // The delay in between ticks |
|
|
|
|
|
|
|
void sendTickPart(int leftCode, int rightCode); |
|
|
|
}; |