Goplus dc motor driver
-
Ok no probs. For now I have stuff going with a jumper wire hack but I can buy some proper jst cables tommorow.
Is the person who wrote the go plus firmware and sample code on this forum? I can understand most of the code but since the code is not documented and not included in the m5 stack arduino library I need some help understanding the messages that get sent out on the i2c bus and what they do.
-
@rob-biernat Looks like he is but he is not active.
@zhouyang can you help? -
Ok so I have the dc motor controller working but when will the sample code be cleaned up and documented. At the moment it's a bit rough with lots of magic numbers scattered through the code. Ideally a proper api
-
Any updates from the bloke who wrote the code?
-
Anything from the programmer?
-
-
Is this the code in question?
#include <Arduino.h> #include <M5Stack.h> #define IrPin 13 #define PLUS_ADDR 0x62 int32_t number = 0; uint8_t press = 0; void setup() { M5.begin(true, false, false); M5.Lcd.setTextFont(6); M5.Lcd.clear(BLACK); M5.Lcd.setTextColor(ORANGE, BLACK); Wire.begin(); ledcSetup(1, 38000, 10); ledcAttachPin(IrPin, 1); } void plus_encode() { Wire.requestFrom(PLUS_ADDR, 2); while(Wire.available()) { int8_t encode = Wire.read(); uint8_t press_n = Wire.read(); number += encode; if(press_n == 0xff) { press = 0; } else { press = 1; } } } void loop() { char data[20]; plus_encode(); ledcWrite(1, ledcRead(1) ? 0 : 512); sprintf(data, "%d %d ", number, press); M5.Lcd.setCursor(100, 100); M5.Lcd.print(data); vTaskDelay(200); }
I have a feeling the engineer who wrote the code may no longer work at M5Stack but i'll make an enquiry.
-
-
Ok given the bloke who wrote the code has left can someone please at least document the i2c messages?
-
https://github.com/m5stack/GoPlus/blob/master/src/src.ino this is sourece code