Commands - SimonTelescopium/PowerBuddy-Arduino-Sketch GitHub Wiki

Command Syntax (you don't need to know this)

: resets buffer (put this before every command)
# terminates command (put this after every command)

COMMANDS ARE CASE SENSITIVE

UPPERCASE = WRITE COMMAND

lowercase = read command

S = set relay position (turn relay on/off)
s = get relay position (read relay position) 
w = get 'write' property for relay - i.e. find out if you can control the switch
n = get number of switches this arduino controls
l = get name (label) of switch
L = set name of switch 
d = get description of switch e.g. 
X = Force a clear Buffer 
P = set power on state for relay
p = read power on stare for relay

EXAMPLES

you can test these with the serial monitor (inverted commas are not part of the string)

                            x = relay number 0 - 7
                      B = Boolean logic, 1 = on, 0 = off
      $30 = string of up to 30 characters (do not use : or # in this string)
      $62 = string of up to 62 characters (do not use : or # in this string)
                      
EXAMPLE      GENERIC EXAMPLE  RESPONSE    COMMENTS          
':S01#'         ':SxB#'       ':SxB#'     turn on(1)/off(0) relay (x) 
':s1#'          ':sx#'        ':sxB#'     read status (B) of relay (x)
':w1#'          ':wx#'        ':wxB#'     read the 'write' property (B) of relay (x) 
':n#'           ':n#'         ':x#'       read how many relays this arduino supports (x)
':L1EQ6 Power#' ':L$30#'      ':Cx#'      write label ($30) of switch (x) 
':l1#'          ':lx#'        ':lx$30#'   read label ($30) of switch (x) 
':d1#'          ':dx#'        ':dx$62#'   read description ($62) of switch (x)
':X#'           ':X#'         NO RESPONSE clears buffer (shouldn't be needed but if the driver gets 
                                          something it doesn't expect it will send this command)
':P11#'         ':PxB#'       ':PxB#'     set the power on state (B) for relay (x)
':p1#'          ':px#'        ':PxB#'     read power on state (B) for relay (x)