diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4434d66
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: c
+compiler:
+ - gcc
+script: script/bootstrap.sh
diff --git a/README.md b/README.md
index e5f353c..b97569c 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# HaxBot
+
+
## Setting up new environment
* git clone https://github.com/fheutz/HaxBot.git
diff --git a/lib/DistanceSensorLib/DistanceSensorLib.h b/lib/DistanceSensorLib/DistanceSensorLib.h
index 368cf23..7637b5e 100644
--- a/lib/DistanceSensorLib/DistanceSensorLib.h
+++ b/lib/DistanceSensorLib/DistanceSensorLib.h
@@ -27,4 +27,5 @@ class DistanceSensor {
// CONSTANTS
};
+
#endif
diff --git a/lib/StepperLib/StepperLib.cpp b/lib/StepperLib/StepperLib.cpp
index 84b75e9..aae992d 100644
--- a/lib/StepperLib/StepperLib.cpp
+++ b/lib/StepperLib/StepperLib.cpp
@@ -13,8 +13,6 @@ Stepper::Stepper() {
STEPPER1 = AccelStepper(HALFSTEP, defaultMotorPin1, defaultMotorPin3, defaultMotorPin2, defaultMotorPin4);
STEPPER2 = AccelStepper(HALFSTEP, defaultMotorPin5, defaultMotorPin7, defaultMotorPin6, defaultMotorPin8);
- delay(1000);
-
initializeStepper(&STEPPER1);
initializeStepper(&STEPPER2);
}
@@ -23,8 +21,6 @@ Stepper::Stepper(short motor1Pins[], short motor2Pins[]) {
STEPPER1 = AccelStepper(HALFSTEP, motor1Pins[0], motor1Pins[2], motor1Pins[1], motor1Pins[3]);
STEPPER2 = AccelStepper(HALFSTEP, motor2Pins[0], motor2Pins[2], motor2Pins[1], motor2Pins[3]);
- delay(1000);
-
initializeStepper(&STEPPER1);
initializeStepper(&STEPPER2);
}
@@ -92,4 +88,6 @@ void Stepper::turnRight(int distance) {
executeMove();
}
-
+uint16_t Stepper::getDistanceToGo() {
+ return _STEPS1;
+}
diff --git a/lib/StepperLib/StepperLib.h b/lib/StepperLib/StepperLib.h
index 6ccbac5..593b98d 100644
--- a/lib/StepperLib/StepperLib.h
+++ b/lib/StepperLib/StepperLib.h
@@ -1,5 +1,5 @@
-#ifndef _DISTANCE_SENSOR_LIB_
-#define _DISTANCE_SENSOR_LIB_
+#ifndef _STEPPER_LIB_
+#define _STEPPER_LIB_
#include
@@ -20,7 +20,6 @@
#define defaultMotorPin7 10 // IN3 on the ULN2003 driver 2
#define defaultMotorPin8 11 // IN4 on the ULN2003 driver 2
-
class Stepper {
public:
@@ -36,6 +35,7 @@ class Stepper {
void moveBackward(int distance);
void turnLeft(int distance);
void turnRight(int distance);
+ uint16_t getDistanceToGo();
private:
@@ -46,12 +46,13 @@ class Stepper {
AccelStepper STEPPER1;
AccelStepper STEPPER2;
- int16_t _STEPS1 = 0;
- int16_t _STEPS2 = 0;
+ uint16_t _STEPS1 = 0;
+ uint16_t _STEPS2 = 0;
// CONSTANTS
- int16_t _stepperSpeed = 1000;
- int16_t _stepperMaxSpeed = 2000;
+ uint16_t _stepperSpeed = 1000;
+ uint16_t _stepperMaxSpeed = 2000;
};
+
#endif
diff --git a/src/HaxBot_with_DistanceSensor/HaxBot_with_DistanceSensor.cpp b/src/HaxBot_with_DistanceSensor/HaxBot_with_DistanceSensor.cpp
new file mode 100644
index 0000000..fd37c1b
--- /dev/null
+++ b/src/HaxBot_with_DistanceSensor/HaxBot_with_DistanceSensor.cpp
@@ -0,0 +1,152 @@
+#include
+#include
+#include
+#include
+
+
+// #define DEBUG 1
+#define STEPS 4076 / 4
+
+#define FORWARD 0
+#define LEFT 1
+#define RIGHT 2
+#define BACKWARD 4
+
+
+DistanceSensor *ds;
+Stepper *stepper;
+uint16_t loopCount = 0;
+uint16_t loopMaxCount = 10000;
+uint16_t stepOfMove = 0;
+uint8_t turn = FORWARD;
+
+
+
+
+void setup() {
+ Serial.begin(115200);
+ Serial.println("### START PROGRAM ###");
+
+ stepper = new Stepper;
+ ds = new DistanceSensor;
+
+ // Timer0 is already used for millis() - we'll just interrupt somewhere
+ // in the middle and call the "Compare A" function below
+// OCR0A = 0xAF;
+// TIMSK0 |= _BV(OCIE0A);
+
+ delay(1000);
+
+}
+
+// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
+//SIGNAL(TIMER0_COMPA_vect) {
+// Serial.println("timer");
+//}
+
+
+
+void turnLeft(int distance) {
+ if (stepOfMove == 0) {
+ stepper->turnLeft(distance);
+ stepOfMove = 1;
+ } else {
+ uint16_t distance = stepper->getDistanceToGo();
+ if (distance == 0) {
+ stepOfMove = 0;
+ } else {
+ stepper->executeMove();
+ }
+ }
+}
+
+void turnRight(int distance) {
+ if (stepOfMove == 0) {
+ stepper->turnRight(distance);
+ stepOfMove = 1;
+ } else {
+ uint16_t distance = stepper->getDistanceToGo();
+ if (distance == 0) {
+ stepOfMove = 0;
+ } else {
+ stepper->executeMove();
+ }
+ }
+
+}
+
+void moveForward(int distance) {
+ if (stepOfMove == 0) {
+ stepper->moveForward(distance);
+ stepOfMove = 1;
+ } else {
+ uint16_t distance = stepper->getDistanceToGo();
+ if (distance == 0) {
+ stepOfMove = 0;
+ } else {
+ stepper->executeMove();
+ }
+ }
+}
+
+void moveBackward(int distance) {
+ if (stepOfMove == 0) {
+ stepper->moveBackward(distance);
+ stepOfMove = 1;
+ } else {
+ uint16_t distance = stepper->getDistanceToGo();
+ if (distance == 0) {
+ stepOfMove = 0;
+ } else {
+ stepper->executeMove();
+ }
+ }
+}
+
+
+void loop() {
+
+
+ // detect obstacles
+ if (loopCount % 10001 == 0) {
+ long distance = ds->getDistance();
+ }
+
+ // detect obstacles
+ if (loopCount % 10001 == 0) {
+ long distance = ds->getDistance();
+ Serial.println(distance);
+ if (distance == 0) {
+ } else if (distance < 20) {
+ if (turn == FORWARD) {
+ turn = LEFT;
+ stepOfMove = 0;
+ } else {
+ turn = FORWARD;
+ }
+ } else {
+ turn = FORWARD;
+ }
+ loopCount = 0;
+ }
+
+
+ // move robot
+ if (loopCount % 100 == 0) {
+ if (turn == LEFT) {
+ turnLeft(STEPS);
+ } else if (turn == RIGHT) {
+ turnRight(STEPS);
+ } else if (turn == FORWARD) {
+ moveForward(STEPS);
+ } else if (turn == BACKWARD) {
+ moveBackward(STEPS);
+ }
+ }
+
+
+ loopCount++;
+
+
+}
+
diff --git a/src/HaxBot_with_DistanceSensor/Makefile b/src/HaxBot_with_DistanceSensor/Makefile
new file mode 100644
index 0000000..0bbfc88
--- /dev/null
+++ b/src/HaxBot_with_DistanceSensor/Makefile
@@ -0,0 +1,88 @@
+### DISCLAIMER
+### This is an example Makefile and it MUST be configured to suit your needs.
+### For detailled explanations about all the avalaible options,
+### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
+
+### PROJECT_DIR
+### This is the path to where you have created/cloned your project
+PROJECT_DIR = ../..
+
+### AVR_GCC_VERSION
+### Check if the version is equal or higher than 4.9
+AVR_GCC_VERSION := $(shell expr `avr-gcc -dumpversion | cut -f1` \>= 4.9)
+
+### ARDMK_DIR
+### Path to the Arduino-Makefile directory.
+ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
+
+### ARDUINO_DIR
+### Path to the Arduino application and ressources directory.
+ARDUINO_DIR = $(PROJECT_DIR)/arduino
+
+### USER_LIB_PATH
+### Path to where the your project's libraries are stored.
+USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
+
+### BOARD_TAG & BOARD_SUB
+### for arduino nano
+#BOARD_TAG = nano
+#BOARD_SUB = atmega328
+### for arduino uno
+BOARD_TAG = uno
+### for arduino mega
+#BOARD_TAG = mega
+#BOARD_SUB = atmega2560
+
+### MONITOR_BAUDRATE
+### It must be set to Serial baudrate value you are using.
+MONITOR_BAUDRATE = 115200
+
+### AVR_TOOLS_DIR
+### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
+#AVR_TOOLS_DIR = /usr
+
+### AVRDDUDE
+### Path to avrdude directory.
+AVRDDUDE = /usr/bin/avrdude
+AVRDUDE_CONF = /etc/avrdude.conf
+#AVRDDUDE = /home/benni/Arduino/avrdude-6.3
+
+### CFLAGS_STD
+CFLAGS_STD = -std=gnu11
+
+### CXXFLAGS_STD
+CXXFLAGS_STD = -std=gnu++11
+
+### CPPFLAGS
+### Flags you might want to set for debugging purpose. Comment to stop.
+CXXFLAGS = -pedantic -Wall -Wextra
+
+### If avr-gcc -v is higher than 4.9, activate coloring of the output
+ifeq "$(AVR_GCC_VERSION)" "1"
+ CXXFLAGS += -fdiagnostics-color
+endif
+
+### MONITOR_PORT
+### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
+#MONITOR_PORT = /dev/ttyUSB0
+MONITOR_PORT = /dev/ttyACM0
+
+### ADUINO PORT
+#ARDUINO_PORT = /dev/ttyUSB0
+ARDUINO_PORT = /dev/ttyACM0
+
+### don't touch this
+CURRENT_DIR = $(shell basename $(CURDIR))
+
+### OBJDIR
+### This is were you put the binaries you just compile using 'make'
+CURRENT_DIR = $(shell basename $(CURDIR))
+OBJDIR = $(PROJECT_DIR)/bin/$(CURRENT_DIR)/$(BOARD_TAG)
+
+# ARDUINO_LIBS
+#ARDUINO_LIBS = DistanceSensorLib StepperLib AccelStepper
+#ARDUINO_LIBS = StepperLib AccelStepper
+
+### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
+include $(ARDMK_DIR)/Arduino.mk
+
diff --git a/test/AccelStepperTest/AccelStepperTest.cpp b/test/AccelStepperTest/AccelStepperTest.cpp
new file mode 100644
index 0000000..6fdce01
--- /dev/null
+++ b/test/AccelStepperTest/AccelStepperTest.cpp
@@ -0,0 +1,80 @@
+#include
+#include
+#define HALFSTEP 8
+
+// motor pins
+#define motorPin1 3 // IN1 on the ULN2003 driver 1
+#define motorPin2 4 // IN2 on the ULN2003 driver 1
+#define motorPin3 5 // IN3 on the ULN2003 driver 1
+#define motorPin4 6 // IN4 on the ULN2003 driver 1
+
+#define motorPin5 8 // IN1 on the ULN2003 driver 2
+#define motorPin6 9 // IN2 on the ULN2003 driver 2
+#define motorPin7 10 // IN3 on the ULN2003 driver 2
+#define motorPin8 11 // IN4 on the ULN2003 driver 2
+
+// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
+AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
+AccelStepper stepper2(HALFSTEP, motorPin5, motorPin7, motorPin6, motorPin8);
+
+// variables
+int turnSteps = 2100; // number of steps for a 90 degree turn
+int lineSteps = -6600; //number of steps to drive straight
+int stepperSpeed = 1000; //speed of the stepper (steps per second)
+int steps1 = 0; // keep track of the step count for motor 1
+int steps2 = 0; // keep track of the step count for motor 2
+
+boolean turn1 = false; //keep track if we are turning or going straight next
+boolean turn2 = false; //keep track if we are turning or going straight next
+
+void setup() {
+ delay(3000); //sime time to put the robot down after swithing it on
+
+ stepper1.setMaxSpeed(2000.0);
+ stepper1.move(1); // I found this necessary
+ stepper1.setSpeed(stepperSpeed);
+
+ stepper2.setMaxSpeed(2000.0);
+ stepper2.move(-1); // I found this necessary
+ stepper2.setSpeed(stepperSpeed);
+
+}
+void loop() {
+
+ if (steps1 == 0) {
+ int target = 0;
+ if (turn1 == true) {
+ target = turnSteps;
+ }
+
+ else {
+ target = lineSteps;
+ }
+
+ stepper1.move(target);
+ stepper1.setSpeed(stepperSpeed);
+ turn1 = !turn1;
+ }
+
+ if (steps2 == 0) {
+ int target = 0;
+ if (turn2 == true) {
+ target = turnSteps;
+ }
+
+ else {
+ target = -lineSteps;
+ }
+
+ stepper2.move(target);
+ stepper2.setSpeed(stepperSpeed);
+ turn2 = !turn2;
+ }
+
+ steps1 = stepper1.distanceToGo();
+ steps2 = stepper2.distanceToGo();
+
+ stepper1.runSpeedToPosition();
+ stepper2.runSpeedToPosition();
+}
+
diff --git a/test/AccelStepperTest/Makefile b/test/AccelStepperTest/Makefile
new file mode 100644
index 0000000..bb16c0e
--- /dev/null
+++ b/test/AccelStepperTest/Makefile
@@ -0,0 +1,87 @@
+### DISCLAIMER
+### This is an example Makefile and it MUST be configured to suit your needs.
+### For detailled explanations about all the avalaible options,
+### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
+
+### PROJECT_DIR
+### This is the path to where you have created/cloned your project
+PROJECT_DIR = ../..
+
+### AVR_GCC_VERSION
+### Check if the version is equal or higher than 4.9
+AVR_GCC_VERSION := $(shell expr `avr-gcc -dumpversion | cut -f1` \>= 4.9)
+
+### ARDMK_DIR
+### Path to the Arduino-Makefile directory.
+ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
+
+### ARDUINO_DIR
+### Path to the Arduino application and ressources directory.
+ARDUINO_DIR = $(PROJECT_DIR)/arduino
+
+### USER_LIB_PATH
+### Path to where the your project's libraries are stored.
+USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
+
+### BOARD_TAG & BOARD_SUB
+### for arduino nano
+#BOARD_TAG = nano
+#BOARD_SUB = atmega328
+### for arduino uno
+BOARD_TAG = uno
+### for arduino mega
+#BOARD_TAG = mega
+#BOARD_SUB = atmega2560
+
+### MONITOR_BAUDRATE
+### It must be set to Serial baudrate value you are using.
+MONITOR_BAUDRATE = 115200
+
+### AVR_TOOLS_DIR
+### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
+#AVR_TOOLS_DIR = /usr
+
+### AVRDDUDE
+### Path to avrdude directory.
+AVRDDUDE = /usr/bin/avrdude
+AVRDUDE_CONF = /etc/avrdude.conf
+#AVRDDUDE = /home/benni/Arduino/avrdude-6.3
+
+### CFLAGS_STD
+CFLAGS_STD = -std=gnu11
+
+### CXXFLAGS_STD
+CXXFLAGS_STD = -std=gnu++11
+
+### CPPFLAGS
+### Flags you might want to set for debugging purpose. Comment to stop.
+CXXFLAGS = -pedantic -Wall -Wextra
+
+### If avr-gcc -v is higher than 4.9, activate coloring of the output
+ifeq "$(AVR_GCC_VERSION)" "1"
+ CXXFLAGS += -fdiagnostics-color
+endif
+
+### MONITOR_PORT
+### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
+MONITOR_PORT = /dev/ttyACM0
+#MONITOR_PORT = /dev/ttyUSB0
+
+### ADUINO PORT
+ARDUINO_PORT = /dev/ttyACM0
+#ARDUINO_PORT = /dev/ttyUSB0
+
+### don't touch this
+CURRENT_DIR = $(shell basename $(CURDIR))
+
+### OBJDIR
+### This is were you put the binaries you just compile using 'make'
+CURRENT_DIR = $(shell basename $(CURDIR))
+OBJDIR = $(PROJECT_DIR)/bin/$(CURRENT_DIR)/$(BOARD_TAG)
+
+# ARDUINO_LIBS
+#ARDUINO_LIBS = StepperLib AccelStepper
+
+### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
+include $(ARDMK_DIR)/Arduino.mk
+
diff --git a/test/DistanceSensorLibDefaultTest/DistanceSensorLibDefaultTest.cpp b/test/DistanceSensorLibDefaultTest/DistanceSensorLibDefaultTest.cpp
index a727891..d0dcc6e 100644
--- a/test/DistanceSensorLibDefaultTest/DistanceSensorLibDefaultTest.cpp
+++ b/test/DistanceSensorLibDefaultTest/DistanceSensorLibDefaultTest.cpp
@@ -5,9 +5,9 @@ DistanceSensor ds;
uint16_t maxRange = 200;
void setup() {
+ Serial.begin(115200);
Serial.println("### START TESTCASE ###");
- Serial.begin(115200);
delay(1000);
}
diff --git a/test/DistanceSensorLibDefaultTest/Makefile b/test/DistanceSensorLibDefaultTest/Makefile
index bd854ac..39c1484 100644
--- a/test/DistanceSensorLibDefaultTest/Makefile
+++ b/test/DistanceSensorLibDefaultTest/Makefile
@@ -25,10 +25,10 @@ USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
### BOARD_TAG & BOARD_SUB
### for arduino nano
-BOARD_TAG = nano
-BOARD_SUB = atmega328
+#BOARD_TAG = nano
+#BOARD_SUB = atmega328
### for arduino uno
-#BOARD_TAG = uno
+BOARD_TAG = uno
### for arduino mega
#BOARD_TAG = mega
#BOARD_SUB = atmega2560
@@ -64,10 +64,12 @@ endif
### MONITOR_PORT
### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
-MONITOR_PORT = /dev/ttyUSB0
+MONITOR_PORT = /dev/ttyACM0
+#MONITOR_PORT = /dev/ttyUSB0
### ADUINO PORT
-ARDUINO_PORT = /dev/ttyUSB0
+ARDUINO_PORT = /dev/ttyACM0
+#ARDUINO_PORT = /dev/ttyUSB0
### don't touch this
CURRENT_DIR = $(shell basename $(CURDIR))
diff --git a/test/StepperLibDefaultTest/Makefile b/test/StepperLibDefaultTest/Makefile
index bcc25ce..bb16c0e 100644
--- a/test/StepperLibDefaultTest/Makefile
+++ b/test/StepperLibDefaultTest/Makefile
@@ -25,10 +25,10 @@ USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
### BOARD_TAG & BOARD_SUB
### for arduino nano
-BOARD_TAG = nano
-BOARD_SUB = atmega328
+#BOARD_TAG = nano
+#BOARD_SUB = atmega328
### for arduino uno
-#BOARD_TAG = uno
+BOARD_TAG = uno
### for arduino mega
#BOARD_TAG = mega
#BOARD_SUB = atmega2560
@@ -64,10 +64,12 @@ endif
### MONITOR_PORT
### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
-MONITOR_PORT = /dev/ttyUSB0
+MONITOR_PORT = /dev/ttyACM0
+#MONITOR_PORT = /dev/ttyUSB0
### ADUINO PORT
-ARDUINO_PORT = /dev/ttyUSB0
+ARDUINO_PORT = /dev/ttyACM0
+#ARDUINO_PORT = /dev/ttyUSB0
### don't touch this
CURRENT_DIR = $(shell basename $(CURDIR))
@@ -78,7 +80,7 @@ CURRENT_DIR = $(shell basename $(CURDIR))
OBJDIR = $(PROJECT_DIR)/bin/$(CURRENT_DIR)/$(BOARD_TAG)
# ARDUINO_LIBS
-ARDUINO_LIBS = StepperLib AccelStepper
+#ARDUINO_LIBS = StepperLib AccelStepper
### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
include $(ARDMK_DIR)/Arduino.mk
diff --git a/test/StepperLibDefaultTest/StepperLibDefaultTest.cpp b/test/StepperLibDefaultTest/StepperLibDefaultTest.cpp
index ecbf5e4..a3f7c5d 100644
--- a/test/StepperLibDefaultTest/StepperLibDefaultTest.cpp
+++ b/test/StepperLibDefaultTest/StepperLibDefaultTest.cpp
@@ -1,21 +1,20 @@
#include
-#include "StepperLib.h"
+#include
+#include
-Stepper stepper;
+Stepper *stepper;
void setup() {
+ Serial.begin(115200);
Serial.println("### START TESTCASE ###");
- Serial.begin(115200);
+ stepper = new Stepper;
delay(1000);
-
}
void loop() {
- stepper.moveForward(1000);
-
- delay(1000);
+ stepper->moveForward(10000);
}
diff --git a/test/StepperLibOneTurnTest/Makefile b/test/StepperLibOneTurnTest/Makefile
new file mode 100644
index 0000000..f93ea1e
--- /dev/null
+++ b/test/StepperLibOneTurnTest/Makefile
@@ -0,0 +1,87 @@
+### DISCLAIMER
+### This is an example Makefile and it MUST be configured to suit your needs.
+### For detailled explanations about all the avalaible options,
+### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
+
+### PROJECT_DIR
+### This is the path to where you have created/cloned your project
+PROJECT_DIR = ../..
+
+### AVR_GCC_VERSION
+### Check if the version is equal or higher than 4.9
+AVR_GCC_VERSION := $(shell expr `avr-gcc -dumpversion | cut -f1` \>= 4.9)
+
+### ARDMK_DIR
+### Path to the Arduino-Makefile directory.
+ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
+
+### ARDUINO_DIR
+### Path to the Arduino application and ressources directory.
+ARDUINO_DIR = $(PROJECT_DIR)/arduino
+
+### USER_LIB_PATH
+### Path to where the your project's libraries are stored.
+USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
+
+### BOARD_TAG & BOARD_SUB
+### for arduino nano
+#BOARD_TAG = nano
+#BOARD_SUB = atmega328
+### for arduino uno
+BOARD_TAG = uno
+### for arduino mega
+#BOARD_TAG = mega
+#BOARD_SUB = atmega2560
+
+### MONITOR_BAUDRATE
+### It must be set to Serial baudrate value you are using.
+MONITOR_BAUDRATE = 115200
+
+### AVR_TOOLS_DIR
+### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
+#AVR_TOOLS_DIR = /usr
+
+### AVRDDUDE
+### Path to avrdude directory.
+AVRDDUDE = /usr/bin/avrdude
+AVRDUDE_CONF = /etc/avrdude.conf
+#AVRDDUDE = /home/benni/Arduino/avrdude-6.3
+
+### CFLAGS_STD
+CFLAGS_STD = -std=gnu11
+
+### CXXFLAGS_STD
+CXXFLAGS_STD = -std=gnu++11
+
+### CPPFLAGS
+### Flags you might want to set for debugging purpose. Comment to stop.
+CXXFLAGS = -pedantic -Wall -Wextra
+
+### If avr-gcc -v is higher than 4.9, activate coloring of the output
+ifeq "$(AVR_GCC_VERSION)" "1"
+ CXXFLAGS += -fdiagnostics-color
+endif
+
+### MONITOR_PORT
+### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
+MONITOR_PORT = /dev/ttyACM0
+#MONITOR_PORT = /dev/ttyUSB0
+
+### ADUINO PORT
+ARDUINO_PORT = /dev/ttyACM0
+#ARDUINO_PORT = /dev/ttyUSB0
+
+### don't touch this
+CURRENT_DIR = $(shell basename $(CURDIR))
+
+### OBJDIR
+### This is were you put the binaries you just compile using 'make'
+CURRENT_DIR = $(shell basename $(CURDIR))
+OBJDIR = $(PROJECT_DIR)/bin/$(CURRENT_DIR)/$(BOARD_TAG)
+
+# ARDUINO_LIBS
+ARDUINO_LIBS = StepperLib AccelStepper
+
+### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
+include $(ARDMK_DIR)/Arduino.mk
+
diff --git a/test/StepperLibOneTurnTest/StepperLibOneTurnTest.cpp b/test/StepperLibOneTurnTest/StepperLibOneTurnTest.cpp
new file mode 100644
index 0000000..a90d41e
--- /dev/null
+++ b/test/StepperLibOneTurnTest/StepperLibOneTurnTest.cpp
@@ -0,0 +1,41 @@
+#include
+#include "StepperLib.h"
+
+short motor1Pins[4] = { 4, 5, 6, 7 };
+short motor2Pins[4] = { 8, 9, 10, 11 };
+
+#define STEPS 4076
+
+
+uint16_t i = 0;
+uint16_t iMax = 4000;
+
+
+Stepper *stepper;
+
+void setup() {
+ Serial.begin(115200);
+ Serial.println("### START TESTCASE ###");
+
+ stepper = new Stepper(motor1Pins, motor2Pins);
+
+
+ delay(1000);
+
+}
+
+void loop() {
+ if (i == 0) {
+ delay(100);
+ stepper->moveForward(STEPS);
+ i++;
+ }
+ uint16_t distance = stepper->getDistanceToGo();
+ if (distance == 0) {
+ i = 0;
+ } else {
+// stepper->moveForward(distance);
+ stepper->executeMove();
+ }
+}
+