int sweepfwd[] = {60,80,80,90,90,90}; int sweepaft[] = {90,90,90,80,80,60}; int heaveup[] = {180,180,180,180,180,180}; int heavedn[] = {160,160,160,160,160,160}; #include SoftwareSerial mySerial(9, 10); // RX, TX int count = 1; void flashLEDs(int i,int j) { i = abs(i-1); j = abs(j-1); delay(100); digitalWrite(7,HIGH); digitalWrite(8,HIGH); delay(100); digitalWrite(7,i); digitalWrite(8,j); } void commandLeg(String commandString) { flashLEDs(0,1); mySerial.println(commandString); flashLEDs(1,0); delay(100); } void setup() { // set the data rate for the SoftwareSerial port mySerial.begin(1200); pinMode(7,OUTPUT); pinMode(8,OUTPUT); String commandString = "N8 speak 003"; commandLeg(commandString); } void loop() { // run over and over String commandString; if (count>999) count=0; commandString = "N8 place 107"; commandLeg(commandString); delay(50); commandString = "N8 count " + String(count); commandLeg(commandString); int leg=0; commandString = "N7 heave 140"; commandLeg(commandString); delay(1000); commandString = "N7 heave 120"; commandLeg(commandString); delay(1000); count++; }