Grove lib for 2 R/C TT moto.

TwoMotoCar.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Copyright (C) 2016 Wesley Tsai (wesleyboy42@gmail.com)
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. this software and associated documentation files (the "Software"), to deal in
  5. the Software without restriction, including without limitation the rights to
  6. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  7. the Software, and to permit persons to whom the Software is furnished to do so,
  8. subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all
  10. copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  13. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  14. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  15. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. */
  18. /*
  19. * Library for controlling two TT moto of DC 3v-12v.
  20. *
  21. * Information about the makercup obtained from:
  22. * https://medium.com/maker-cup
  23. */
  24. #ifndef __TwoMotoCar_h__
  25. #define __TwoMotoCar_h__
  26. #include "Arduino.h"
  27. class TwoMotoCar
  28. {
  29. public:
  30. TwoMotoCar(byte MotoPinL1, byte MotoPinL2, byte MotoPinR1, byte MotoPinR2);
  31. ~TwoMotoCar();
  32. void init();
  33. void forward(void);
  34. void right(void);
  35. void left(void);
  36. void backward(void);
  37. void stop(void);
  38. private:
  39. byte _MotoPinL1;
  40. byte _MotoPinL2;
  41. byte _MotoPinR1;
  42. byte _MotoPinR2;
  43. };
  44. #endif