Hello, very newb to arduino. I have the Sparkfun RedBoard Artemis Nano SparkFun RedBoard Artemis Nano - DEV-15443 - SparkFun Electronics and the newer Sparkfun Serial Controlled Motor Driver SparkFun Serial Controlled Motor Driver - ROB-13911 - SparkFun Electronics
I've been able to successfully read POT values with it and led blinking on it, so I know I can compile and upload ok. I don't necessarily have it wired/hooked up correctly to work with the scmd, but I assume that shouldn't give a compile error.
I'm trying to experiment with the example "MotorTest" to learn more about how to build a custom servo controller (which may be the wrong way to learn). However in the Arduino IDE (1.8.15 and I've tried earlier versions), it starts to compile, but then gives some errors and I don't know how to troubleshoot those errors. Probably because I don't know anything about arduino. I may be trying to do something that is completely wrong. My "layman's" interpretation of the errors lead me to believe the program is trying to call functions that don't exist in the library it's calling.
This is the MotorTest example program I'm trying to compile:
/******************************************************************************
MotorTest.ino
Serial Controlled Motor Driver
Marshall Taylor @ SparkFun Electronics
Sept 15, 2016
https://github.com/sparkfun/Serial_Controlled_Motor_Driver
https://github.com/sparkfun/SparkFun_Serial_Controlled_Motor_Driver_Arduino_Library
Resources:
Uses Wire.h for i2c operation
Uses SPI.h for SPI operation
Development environment specifics:
Arduino IDE 1.6.7
Teensy loader 1.27
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
Please review the LICENSE.md file included with this example. If you have any questions
or concerns with licensing, please contact techsupport@sparkfun.com.
Distributed as-is; no warranty is given.
******************************************************************************/
//This example steps through all motor positions moving them forward, then backwards.
//To use, connect a redboard to the user port, as many slaves as desired on the expansion
//port, and run the sketch.
//
// Notes:
// While using SPI, the defualt LEDPIN will not toggle
// This steps through all 34 motor positions, which takes a few seconds to loop.
#include <Arduino.h>
#include <stdint.h>
#include "SCMD.h"
#include "SCMD_config.h" //Contains #defines for common SCMD register names and values
#include "Wire.h"
#define LEDPIN 13
SCMD myMotorDriver; //This creates the main object of one motor driver and connected slaves.
void setup()
{
Serial.begin(9600);
pinMode(LEDPIN, OUTPUT);
Serial.println("Starting sketch.");
//***** Configure the Motor Driver's Settings *****//
// .commInter face can be I2C_MODE or SPI_MODE
myMotorDriver.settings.commInterface = I2C_MODE;
//myMotorDriver.settings.commInterface = SPI_MODE;
// set address if I2C configuration selected with the config jumpers
myMotorDriver.settings.I2CAddress = 0x5A; //config pattern "0101" on board for address 0x5A
// set chip select if SPI selected with the config jumpers
myMotorDriver.settings.chipSelectPin = 10;
//*****initialize the driver get wait for idle*****//
while ( myMotorDriver.begin() != 0xA9 ) //Wait until a valid ID word is returned
{
Serial.println( "ID mismatch, trying again" );
delay(500);
}
Serial.println( "ID matches 0xA9" );
// Check to make sure the driver is done looking for slaves before beginning
Serial.print("Waiting for enumeration...");
while ( myMotorDriver.ready() == false );
Serial.println("Done.");
Serial.println();
//*****Set application settings and enable driver*****//
while ( myMotorDriver.busy() );
myMotorDriver.enable();
Serial.println();
}
void loop()
{
//***** Operate the Motor Driver *****//
// This walks through all 34 motor positions driving them forward and back.
// It uses .setDrive( motorNum, direction, level ) to drive the motors.
Serial.println("Now stepping through the motors.");
for (int i = 0; i < 34; i++)
{
digitalWrite( LEDPIN, 1 );
myMotorDriver.setDrive( i, 1, 255); //Drive motor i forward at full speed
delay(250);
digitalWrite( LEDPIN, 0 );
myMotorDriver.setDrive( i, 0, 255); //Drive motor i backward at full speed
delay(250);
myMotorDriver.setDrive( i, 1, 0);
}
}
The 4 errors seem to have something to do with:
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp
Here is a partial copy of the verbose compile messages starting from the first orange colored text:
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp: In member function 'uint8_t SCMD::begin()':
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp:106:7: error: 'class arduino::MbedSPI' has no member named 'setClockDivider'
SPI.setClockDivider(SPI_CLOCK_DIV32);
^~~~~~~~~~~~~~~
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp:106:23: error: 'SPI_CLOCK_DIV32' was not declared in this scope
SPI.setClockDivider(SPI_CLOCK_DIV32);
^~~~~~~~~~~~~~~
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp:108:7: error: 'class arduino::MbedSPI' has no member named 'setBitOrder'
SPI.setBitOrder(MSBFIRST);
^~~~~~~~~~~
C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver\src\SCMD.cpp:111:7: error: 'class arduino::MbedSPI' has no member named 'setDataMode'
SPI.setDataMode(SPI_MODE0);
^~~~~~~~~~~
Using library Serial_Controlled_Motor_Driver at version 1.0.4 in folder: C:\Users\UserName\Documents\Arduino\libraries\Serial_Controlled_Motor_Driver
Using library Wire at version 2.0.0 in folder: C:\Users\UserName\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.1.1\libraries\Wire
Using library SPI at version 2.0.0 in folder: C:\Users\UserName\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.1.1\libraries\SPI
exit status 1
Error compiling for board RedBoard Artemis Nano.
Thanks for looking.