GoPlus.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __GOPLUS_H__
  2. #define __GOPLUS_H__
  3. #include <Wire.h>
  4. #define GOPLUS_ADDR 0x5d
  5. #define SERVO_ADDR 0x10
  6. #define SERVO_NUM0 0x00
  7. #define SERVO_NUM1 0x01
  8. #define SERVO_NUM2 0x02
  9. #define SERVO_NUM3 0x03
  10. #define MOTOR_ADDR 0x30
  11. #define MOTOR_NUM0 0x00
  12. #define MOTOR_NUM1 0x02
  13. #define HUB1_ADDR 0x40
  14. #define HUB2_ADDR 0x50
  15. #define HUB3_ADDR 0x60
  16. #define HUB_NUM0 0x06
  17. #define HUB_NUM1 0x07
  18. #define HUB_READ 0x00
  19. #define HUB_WIRE 0x80
  20. #define HUB_DIGITAL 0x00
  21. #define HUB_ANALOG 0x01
  22. class GoPlus {
  23. public:
  24. GoPlus();
  25. void begin();
  26. void Servo_write_angle(uint8_t number, uint8_t angle);
  27. void Motor_write_speed(uint8_t number, uint8_t trun, uint8_t motor_speed);
  28. uint16_t hub1_a_read_value(uint8_t reg);
  29. uint16_t hub1_d_read_value(uint8_t reg);
  30. uint16_t hub2_d_read_value(uint8_t reg);
  31. uint16_t hub3_d_read_value(uint8_t reg);
  32. uint16_t hub2_a_read_value(uint8_t reg);
  33. uint16_t hub3_a_read_value(uint8_t reg);
  34. void hub1_wire_value(uint8_t reg, uint16_t value);
  35. void hub2_wire_value(uint8_t reg, uint16_t value);
  36. void hub3_wire_value(uint8_t reg, uint16_t value);
  37. public:
  38. private:
  39. private:
  40. };
  41. #endif