Ok I have it working pretty good. I have a video too here: https://www.youtube.com/watch?v=YBieM-_nFbw
here is the code I used, very simple. Perfect for kids. I’m working on doing this with a Balboa now.
/*
My Example 9/17/2018
*/
#include <SoftwareSerial.h>
#include <Servo.h>
Servo myservo1, myservo2;
char c;
String readString[10];
int MyInt1, State1, State2;
int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial mySerial(bluetoothRx, bluetoothTx); // Set up serial port to pins 2 TX and 3 RX
void setup() {
myservo1.attach(9); // Continuous tern servos
myservo2.attach(10); // Continuous tern servos
Serial.begin(9600);
State1 = 0;
digitalWrite(13,LOW); // Lights out
while (!Serial) {
}
mySerial.begin(57600); // This was the speed it liked.
}
void loop() { // run over and over to get the button presses
int i = 0;
while (mySerial.available()) {
delay(2);
c = mySerial.read();
if (c != ‘\n’){
readString[ i ] = String(c);
i = i + 1;
}
}
// Now make the robot move in accordance with the button presses
// Full Stop
if (readString[3] == String(‘0’)){
digitalWrite(13,LOW);
//Serial.write(“S”);
State1 = 1;
myservo1.writeMicroseconds(1500); // Make Servo Stop Moving
myservo2.writeMicroseconds(1500); // Make Servo Stop Moving
}
// Full Forward
else if(readString[2] == String(‘5’)){
digitalWrite(13,HIGH);
//Serial.write(“F”);
myservo1.writeMicroseconds(2000); // Make Servo Move
myservo2.writeMicroseconds(1000); // Make Servo Move
}
// Right Turn
else if(readString[2] == String(‘8’)){
digitalWrite(13,HIGH);
//Serial.write(“R”);
myservo1.writeMicroseconds(2200); // Make Servo Move
myservo2.writeMicroseconds(1700); // Make Servo Move
}
// Left Turn
else if(readString[2] == String(‘7’)){
digitalWrite(13,HIGH);
//Serial.write(“L”);
myservo1.writeMicroseconds(1300); // Make Servo Move
myservo2.writeMicroseconds(800); // Make Servo Move
}
// Backwards
else if(readString[2] == String(‘6’)){
digitalWrite(13,HIGH);
//Serial.write(“B”);
myservo1.writeMicroseconds(1000); // Make Servo Move
myservo2.writeMicroseconds(2000); // Make Servo Move
}
}
// An that’s it