Chapter 13
5
The respond_to_command routine responds to the two commands defined
earlier in this chapter. The function executes on detecting a received LF.respond_to_command:
' On receiving a valid command, call a routine to handle the specific command.' Every command begins with a COMMAND_START code, the node's address,
' and a command code.if (received_command[0] = COMMAND_START) thenif (received_command[1] = MY_ADDRESS) thenselect case received_command[2]case "1"gosub command_write_bytecase "2"gosub command_read_byte‘ Add additonal supported commands here.case elsegosub initialize_serial_buffersend select
elsegosub initialize_serial_buffersendif
else
gosub initialize_serial_buffers
endif
return