I running the following code with Seeeduino Cortex M0, DC fan and Grove - I2C Motor Driver (TB6612FNG) but I get error ,any idea why?
Code:
#include "Grove_Motor_Driver_TB6612FNG.h"
#include <Wire.h>
MotorDriver motor;
void setup()
{
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();
Serial.begin(9600);
motor.init();
}
void loop()
{
// drive 2 dc motors at speed=255, clockwise
Serial.println("run at speed=255");
motor.dcMotorRun(MOTOR_CHA, 255);
delay(1000);
}
Errors:
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
^~~~~~~~~~~~~
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp:276:62: note: suggested alternative: 'REG_DSU_LENGTH'
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
^~~~~~~~~~~~~
REG_DSU_LENGTH
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp:416:70: error: 'BUFFER_LENGTH' was not declared in this scope
for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
^~~~~~~~~~~~~
c:\Users\alirazi\Desktop\libraries\Grove_-_Motor_Driver_TB6612FNG\I2Cdev.cpp:416:70: note: suggested alternative: 'REG_DSU_LENGTH'
for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
^~~~~~~~~~~~~
REG_DSU_LENGTH
exit status 1
Compilation error: exit status 1