When I replaced `setMotorSpeed() with
smcSerial.write(0xAA, 0x0D, 0x05, 0x00, 0x64); //set motor 1 full speed forward
I get this error: no matching function for call to ‘SoftwareSerial::write(int, int, int, int, int)’
Verbose Error message
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Administrator\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10808 -build-path C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_543807 -warnings=none -build-cache C:\Users\ADMINI~1\AppData\Local\Temp\arduino_cache_823002 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\Administrator\Documents\Arduino\Indiv_Motor1_modified_Pin4_5_Rx\Indiv_Motor1_modified_Pin4_5_Rx.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Administrator\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10808 -build-path C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_543807 -warnings=none -build-cache C:\Users\ADMINI~1\AppData\Local\Temp\arduino_cache_823002 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\Administrator\Documents\Arduino\Indiv_Motor1_modified_Pin4_5_Rx\Indiv_Motor1_modified_Pin4_5_Rx.ino
Using board 'uno' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\sketch\\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp" -o nul
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\sketch\\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp" -o nul
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src\\SoftwareSerial.cpp" -o nul
Generating function prototypes...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\sketch\\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\sketch\\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\arduino_build_543807\\sketch\\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp.o"
C:\Users\Administrator\Documents\Arduino\Indiv_Motor1_modified_Pin4_5_Rx\Indiv_Motor1_modified_Pin4_5_Rx.ino: In function 'void loop()':
Indiv_Motor1_modified_Pin4_5_Rx:51:45: error: no matching function for call to 'SoftwareSerial::write(int, int, int, int, int)'
smcSerial.write(0xAA, 0x0D, 0x05, 0x00, 0x64); //set motor 1 full speed forward
^
In file included from C:\Users\Administrator\Documents\Arduino\Indiv_Motor1_modified_Pin4_5_Rx\Indiv_Motor1_modified_Pin4_5_Rx.ino:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SoftwareSerial\src/SoftwareSerial.h:102:18: note: candidate: virtual size_t SoftwareSerial::write(uint8_t)
virtual size_t write(uint8_t byte);
^
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SoftwareSerial\src/SoftwareSerial.h:102:18: note: candidate expects 1 argument, 5 provided
In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Stream.h:26:0,
from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,
from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:232,
from C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_543807\sketch\Indiv_Motor1_modified_Pin4_5_Rx.ino.cpp:1:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:57:12: note: candidate: size_t Print::write(const char*, size_t)
size_t write(const char *buffer, size_t size) {
^
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:57:12: note: candidate expects 2 arguments, 5 provided
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:56:20: note: candidate: virtual size_t Print::write(const uint8_t*, size_t)
virtual size_t write(const uint8_t *buffer, size_t size);
^
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:56:20: note: candidate expects 2 arguments, 5 provided
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:52:12: note: candidate: size_t Print::write(const char*)
size_t write(const char *str) {
^
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Print.h:52:12: note: candidate expects 1 argument, 5 provided
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SoftwareSerial
exit status 1
no matching function for call to 'SoftwareSerial::write(int, int, int, int, int)'
#include <SoftwareSerial.h>
#define rxPin 3 // pin 3 connects to smcSerial TX (not used in this example)
#define txPin 4 // pin 4 connects to smcSerial RX
#define txPin 5 // pin 5 connects to smcSerial RX
SoftwareSerial smcSerial = SoftwareSerial(rxPin, txPin);
// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
{
smcSerial.write(0x83);
}
// speed should be a number from -3200 to 3200
void setMotorSpeed(int speed)
{
if (speed < 0)
{
smcSerial.write(0x86); // motor reverse command
speed = -speed; // make speed positive
}
else
{
smcSerial.write(0x85); // motor forward command
}
smcSerial.write(speed & 0x1F);
smcSerial.write(speed >> 5 & 0x7F);
}
void setup()
{
// Initialize software serial object with baud rate of 19.2 kbps.
smcSerial.begin(19200);
// The Simple Motor Controller must be running for at least 1 ms
// delay here for 5 ms.
delay(5);
// If the Simple Motor Controller has automatic baud detection
// enabled, send the byte 0xAA (170 in decimal)
// so that it can learn the baud rate.
smcSerial.write(0xAA);
// Exit Safe Start command,
// clears the safe-start violation and lets the motor run.
exitSafeStart();
}
void loop()
{
smcSerial.write(0xAA, 0x0D, 0x05, 0x00, 0x64); //set motor 1 full speed forward
delay(8000);
setMotorSpeed(-1000); // half-speed reverse
delay(4000);
setMotorSpeed(1000); // half-speed forward
delay(4000);
setMotorSpeed(-3200); // full-speed reverse
delay(10000);
setMotorSpeed(3200); // full-speed forward
delay(8000);
setMotorSpeed(-1000); // half-speed reverse
delay(4000);
setMotorSpeed(1000); // half-speed forward
delay(4000);
setMotorSpeed(-3200); // full-speed reverse
delay(10000);
}