I am currently sending position and relay switch commands to an XY table using a script in Hyperterminal. Is it feasable to run such a sketch from arduino as a standalone device, without a PC?
This is an example of the commands sent from hyperterminal.
set_rack(1,40)
set_rack(2,40)
set_rack(3,40)
move_sample(1,1)
relay_write(a,1)
relay_write(a,0)
move_sample(1,2)
relay_write(a,1)
relay_write(a,0)
move_sample(1,3)
relay_write(a,1)
relay_write(a,0)
move_sample(1,4)
relay_write(a,1)
relay_write(a,0)
move_sample(1,5)
relay_write(a,1)
relay_write(a,0)
move_sample(1,6)
I am using a UNO board , and have tried connecting it from RS232 pins 0 and 1 through an RS232 interface board.
I have tried the following sketch utilising the "serial print" command without success ( a shortenened version)
const int A=5000;//set delay
const int B=5000;//set delay
const int C=5000;//set delay
//
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
}
void loop() {
// prints value unaltered, i.e. the raw binary version of the
// byte. The serial monitor interprets all bytes as ASCII,
Serial.print("set_rack(1,40)");
Serial.print("set_rack(2,40)");
Serial.print("set_rack(3,40)");
Serial.print("move_sample(1,1)");
delay(A);
Serial.print("relay_write(a,1)");
delay(B);
Serial.print("relay_write(a,0)");
delay(C);
Serial.print("move_sample(1,2)");
delay(A);
Serial.print("relay_write(a,1)");
delay(B);
Serial.print("relay_write(a,0)");
delay(C);
Serial.print("move_sample(1,3)");
}