import rmapcfg
from PiStorms import PiStorms

debug = False
device_dict = rmap.dict
read_dict = rmap.read_dict
command_array = []
command_array1 = []
string_message = ""
psm = PiStorms()
lasttime = int(round(time.time() * 1000))
# Connect to Scratch
try:
    s = scratch.Scratch(host=rmapcfg.host, port=rmapcfg.port)
    if s.connected:
        rmap.rmap_print("Connected")
except scratch.ScratchError:
    rmap.rmap_print(
        "Scratch is either not opened or remote sensor connections aren't enabled"
    )

# Broadcast 'READY' to Scratch
try:
    s.broadcast('READY')
    time.sleep(.5)
except NameError:
    #pass
    print "Did not send Ready"

doExit = False
# Handles messages received from Scratch
import rmapcfg
from PiStorms import PiStorms

debug = False
device_dict = rmap.dict
read_dict = rmap.read_dict
command_array = []
command_array1 = []
string_message = ""
psm = PiStorms()
lasttime = int(round(time.time() * 1000))
# Connect to Scratch
try:
    s = scratch.Scratch(host=rmapcfg.host, port=rmapcfg.port)
    if s.connected:
        rmap.rmap_print("Connected")
except scratch.ScratchError:
    rmap.rmap_print("Scratch is either not opened or remote sensor connections aren't enabled")

# Broadcast 'READY' to Scratch
try:
    s.broadcast('READY')
    time.sleep(.5)
except NameError:
    #pass
    print "Did not send Ready"

doExit = False
# Handles messages received from Scratch
while doExit == False:
    try: