ESC.h 828 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Electronic Speed Controller (ESC) - Library */
  2. /*
  3. */
  4. #ifndef ESC_Library
  5. #define ESC_Library
  6. #if (ARDUINO >= 100)
  7. #include "Arduino.h"
  8. #else
  9. #include "WProgram.h"
  10. #endif
  11. #include <Servo.h> // Including the Servo library
  12. #define ESC_CAL_DELAY (8000) // Calibration delay (milisecond)
  13. #define ESC_STOP_PULSE (500) //
  14. class ESC
  15. {
  16. public:
  17. ESC(byte ESC_pin, int outputMin = 1000, int outputMax = 2000, int armVal = 500);
  18. ~ESC();
  19. void calib(void);
  20. void arm(void);
  21. void stop(void);
  22. void speed(int ESC_val);
  23. private:
  24. // < Local attributes >
  25. // Hardware
  26. byte oPin; // ESC output Pin
  27. // Calibration
  28. int oMin = 1000;
  29. int oMax = 2000;
  30. int oESC = 1000;
  31. int oArm = 500;
  32. Servo myESC; // create servo object to control an ESC
  33. };
  34. #endif
  35. /* Electronic Speed Controller (ESC) - Library */