I am currently trying to get my Arduino Mini Pro 5V 16Mhz to control the serial motor controller from Sparkfun ( linked here
http://www.sparkfun.com/products/9571 ) and am running into a coding issue that I think may be the problem. The commands of the serial driver call for an end command '\r' which the arduino will not output. Instead I get all of the commands sans the '\r' to print. Does anyone want to enlighten me on what I am doing wrong? Code Below
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
int incomingByte = 0; // for incoming serial data
void setup() {
}
void loop() {
Serial.begin(9600);
mySerial.begin(115200);
// send data only when you receive data:
if (mySerial.available() > 0) {
mySerial.print('1');
Serial.print('1');
mySerial.print('F');
Serial.print('F');
mySerial.print('5');
Serial.print('5');
mySerial.print('\r');
Serial.print('\r');
mySerial.println();
Serial.println();
digitalWrite(13, HIGH);
delay(1000);
}
else {
digitalWrite(13, LOW);
}
}