Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
911 B

  1. #ifndef MX1508_h
  2. #define MX1508_h
  3. #include "Arduino.h"
  4. typedef enum
  5. {
  6. FAST_DECAY = 0, // set non-PWM pin low
  7. SLOW_DECAY = 1 // set non-PWM pin high
  8. } DecayMode;
  9. typedef enum
  10. {
  11. PWM_1PIN = 1,
  12. PWM_2PIN = 2
  13. } NumOfPwmPins;
  14. class MX1508 {
  15. public:
  16. MX1508(uint8_t pinIN1, uint8_t pinIN2); // default fast decay, 2 pwm pins
  17. MX1508(uint8_t pinIN1, uint8_t pinIN2, DecayMode decayMode, NumOfPwmPins numPWM);
  18. void motorGo(long pwmVal); //
  19. void setResolution(unsigned int resolution);
  20. int getPWM();
  21. void stopMotor();
  22. void analogWrite16(uint8_t pin, uint16_t val);
  23. void setPWM16(uint8_t prescaler, unsigned int resolution);
  24. private:
  25. uint8_t _pinIN1;
  26. uint8_t _pinIN2;
  27. bool _useAnalogWrite16 = false;
  28. int _pwmVal;
  29. int _pwmResolution = 255; //max resolution of pwm, default is 255.
  30. DecayMode _whichMode;
  31. NumOfPwmPins _numPwmPins;
  32. };
  33. #endif