user41343: https://github.com/sparkfun/SparkFun_MiniMoto_Arduino_Library/tree/V_1.1.0
Will this library work on an esp8266?   If not is there any way I can get this driver to work on the ESP?

user41343: As Ignacio kindly pointed out (+1), the answer to my original question is no.

The following code works to control a Sparkfun Minimoto board, though, or more generally the DRV8830.   Just connect GPIO5 to SCL and GPIO4 to SDA.   On some variants the default SDA/SCL pins are different though -- you can always use any pins (except for GPIO0, GPIO2, and GPIO15 -- see my recent post on using these pins) for your I2C bus and just call wire.begin(sda,scl) where sda and scl are the pin numbers you want.
#include <Wire.h>

#define MOTORA_WRITE 0x64
#define MOTORA_READ 0x65
#define CONTROL_addr 0x00
#define FAULT_addr 0x01

void setup() {
  Wire.begin();

  drive(20);//enter values from -63 to 63, where negative values are reverse
  delay(100);
  coast();//releases the motor
  delay(100);
  brake();//brakes the motor

}

void loop() {
  // put your main code here, to run repeatedly:

}

byte tsState = -99;//used so redundant calls of any of these methods don't do anything -- only new calls will trigger communication with the motor controller
void drive(int speed) {
  if (speed != tsState) {
    tsState = speed;
    // Write to the Fault Register to reset it
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);

    // Write to the Control Register
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue;
    regValue = (byte)abs(speed); // Find the byte-ish abs value of the input
    if (regValue > 63) regValue = 63;
    regValue = regValue << 2; // Left shift to make room for bits 1:0
    if (speed < 0) regValue |= 0x01; // Set bits 1:0 based on sign of input.
    else regValue |= 0x02;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}
void brake() {
  if (tsState != -98) {
    tsState = -98;
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue = (byte)63;
    regValue = regValue << 2;
    regValue |= 0x03;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}
void coast() {
  if (tsState != -97) {
    tsState = -97;
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue = (byte)0;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}


user368: No, since it uses AVR defines. Convert the code that uses these defines to the equivalent ESP8266 code instead.

41343: <p><a href="https://github.com/sparkfun/SparkFun_MiniMoto_Arduino_Library/tree/V_1.1.0" rel="nofollow noreferrer">https://github.com/sparkfun/SparkFun_MiniMoto_Arduino_Library/tree/V_1.1.0</a></p>

<p>Will this library work on an esp8266?   If not is there any way I can get this driver to work on the ESP?</p>
 41343: <p>As Ignacio kindly pointed out (+1), the answer to my original question is no.</p>

<hr>

<p>The following code works to control a Sparkfun Minimoto board, though, or more generally the DRV8830.   Just connect GPIO5 to SCL and GPIO4 to SDA.   On some variants the default SDA/SCL pins are different though -- you can always use any pins (except for GPIO0, GPIO2, and GPIO15 -- see <a href="https://electronics.stackexchange.com/questions/389293/can-i-connect-the-esp8266s-boot-mode-select-pins-directly-to-logic-warning-m/389294#389294">my recent post</a> on using these pins) for your I2C bus and just call wire.begin(sda,scl) where sda and scl are the pin numbers you want.</p>

<pre><code>#include &lt;Wire.h&gt;

#define MOTORA_WRITE 0x64
#define MOTORA_READ 0x65
#define CONTROL_addr 0x00
#define FAULT_addr 0x01

void setup() {
  Wire.begin();

  drive(20);//enter values from -63 to 63, where negative values are reverse
  delay(100);
  coast();//releases the motor
  delay(100);
  brake();//brakes the motor

}

void loop() {
  // put your main code here, to run repeatedly:

}

byte tsState = -99;//used so redundant calls of any of these methods don't do anything -- only new calls will trigger communication with the motor controller
void drive(int speed) {
  if (speed != tsState) {
    tsState = speed;
    // Write to the Fault Register to reset it
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);

    // Write to the Control Register
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue;
    regValue = (byte)abs(speed); // Find the byte-ish abs value of the input
    if (regValue &gt; 63) regValue = 63;
    regValue = regValue &lt;&lt; 2; // Left shift to make room for bits 1:0
    if (speed &lt; 0) regValue |= 0x01; // Set bits 1:0 based on sign of input.
    else regValue |= 0x02;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}
void brake() {
  if (tsState != -98) {
    tsState = -98;
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue = (byte)63;
    regValue = regValue &lt;&lt; 2;
    regValue |= 0x03;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}
void coast() {
  if (tsState != -97) {
    tsState = -97;
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(FAULT_addr);
    Wire.write(0x80);
    Wire.endTransmission(true);
    Wire.beginTransmission(MOTORA_WRITE);
    Wire.write(CONTROL_addr);
    byte regValue = (byte)0;
    Wire.write(regValue);
    Wire.endTransmission(true);
  }
}
</code></pre>
 368: <p>No, since it uses AVR defines. Convert the code that uses these defines to the equivalent ESP8266 code instead.</p>
