/* Name: Nexgen_Rover_v4.h Created: 9/24/2023 3:35:45 PM Author: Peter Januarius Editor: http://www.visualmicro.com */ #ifndef _Nexgen_Rover_v4_h #define _Nexgen_Rover_v4_h #if defined(ARDUINO) && ARDUINO >= 100 #include "arduino.h" #else #include "WProgram.h" #endif #include "pitches.h" #include #include "Ultrasonic.h" class NXG_Rover { // ############## METHODS ############### public: /* Constructor */ NXG_Rover(bool debug = false); NXG_Rover(HardwareSerial* serial, bool debug = false); /* General Methods */ void init(); /* Test methods */ long getRandomNumber(); float getPi(); /* Drive methods */ void forward(int speedL, int speedR); void forward(int speed); void backward(int speedL, int speedR); void backward(int speed); void setSpeed(int sp); void setSpeed(int sp_left, int sp_right); void setSpeedLeft(int sp_left); void setSpeedRight(int sp_right); void setDirection(int dLeft, int dRight); void turnLeft(int sp); void turnRight(int sp); void veerLeft(int sp_left, int sp_right); void veerRight(int sp_left, int sp_right); void stop(); /* Buzzer methods */ void playMelody(int melody[], int num_notes); void playTone(int freq); /* Servo and Ultrasonic Methods */ // For now, I will leave them in the client protected: //... ... private: //... ... // ############## DATA ############### public: //... ... int buzzerPin = 8; int touchSensorPin = 9; Servo servo; protected: //... ... private: #define MOTOR_LEFT_PIN 3 #define MOTOR_RIGHT_PIN 6 #define DIR_LEFT_PIN 2 #define DIR_RIGHT_PIN 5 bool _debug; HardwareSerial* _serial = nullptr; }; #endif