I am trying to interface to a EFX-Tek RC-4 Board using serial communication. The RC-4 is a relay board and in order to control it, it needs to be sent a string like this ("!RC4", %00, "R", 1, 1). Does anyone have any suggestions on how to send this string?
it needs to be sent a string like this ("!RC4", %00, "R", 1, 1).
Sigh. No it doesn't. What horrible documentation, hopelessly confusing the string "on the wire" with the command you have to give to a basic stamp to send that string. Double Sigh.
The RC4 uses the "AppMod" protocol from Parallax. I couldn't find a formal description of the protocol, but some of the documentation for the parallax add-on boards is a little better. It looks like a command starts with a '!' character, followed by two bytes worth of board type ("RC"), one byte of "unit address" (binary for the RC4), followed by a command and arguments for the command (whose format is apparently device specific.) So for the RC4 the command will look like "!RC4.R..", where the first "." is a binary zero, the second and third dots are binary 1.
So you might do something like
RC4_reset_relay(which, state)
{
Serial.print("!RC4"); // Preamble and device identifier
Serial.print(0, BYTE); // which board (always zero)
Serial.print('R', BYTE); // command to set/reset individual relay
Serial.print(which, BYTE); // output which relay
Serial.print(state, BYTE); // and what state we want.
}