#ifndef BeerBotLib_h #define BeerBotLib_h #include "Arduino.h" #include "Servo.h" #include "NewPing.h" /** * class to add some additional features for the servo. */ class NewServo { public: void setup(int servoPin, int pos, boolean newServo); int getPos(); void setPos(int pos); void sweep(int servoSpeed, int servoRange, int servoDelay); private: Servo myServo; int position; int direction; }; /** * class for working with an ultrasonic distance sensor. * is not used for the roboter in its current state. */ class DistanceSensor { public: void setup(int inputPin, int outputPin, int servoPin); int getPos(); int getDistance(); private: NewPing sensor; NewServo myServo; }; /** * class to control the stepper motors. */ class StepperMotor { public: void setup(int stepPin, int directionPin); void makeStep(boolean direction); private: int stepPin; int directionPin; }; /** * class to control the whole gear of the servo. */ class Gear { public: void setup(float wheelDiameter, float axisDistance, int leftMotorStepPin, int leftMotorDirPin, int rightMotorStepPin, int rightMotorDirPin); void turnToServoPos(int servPos, int stepSpeed, int tolerance, int partAngle); void turnAngle (int angle, boolean turnDirection, int stepSpeed); void drive(float distance, int stepSpeed, boolean driveDirection); private: float wheelDiameter; float axisDistance; StepperMotor rightMotor; StepperMotor leftMotor; }; /** * class to trigger the pusher(s). */ class Pusher { public: void setup(int pusherPin); void push(int duration); private: int pusherPin; }; /** * class to control the barriers. */ class Barrier { public: void setup(int servoPin, int closedPos, int openPos); void openBarrier(); void closeBarrier(); private: NewServo myServo; boolean closed; int closedPos; int openPos; }; /** * class to control the push button contact sensors. */ class ContactSensor { public: void setup(int rightButtonPin, int leftButtonPin, int conductorPin); boolean rightButtonPushed(); boolean leftButtonPushed(); boolean isConducting(); private: int rightButtonPin; int leftButtonPin; int conductorPin; }; #endif