def sendColorArray():
    time.sleep(1)
    sendstrings = [];
    currentString = ""
    for colour in colors:
        s = ""
        s = s + "i" + str(colour['i'])
        s = s + "r" + str(colour['r'])
        s = s + "g" + str(colour['g'])
        s = s + "b" + str(colour['b'])

        if (len(currentString+s) > 1023):
            sendstrings.append(currentString)
            currentString = s
        else:
            currentString = currentString + s

    sendstrings.append(currentString)


    for string in sendstrings:
        sent = False
        while(not sent):
            print "OUT"
            print string
            print len(string)
            o = serial.command(string)
            if o:
                print "IN"
                print o
                print len(o)
                if string == o:
                    print "CORRECT"
                    sent = True
                time.sleep(.1)
def sendString(str):
    sent = False
    while(not sent):
        print "OUT"
        print str
        print len(str)
        o = serial.command(str)
        if o:
            print "IN"
            print o
            print len(o)
            if str == o:
                print "CORRECT"
                sent = True
            time.sleep(2)
def main():
  serial = Serial(port='COM5', rate=115200)
  passed = 0
  failed = 0
  for i in range(1000):
      l = random.randint(1, 1023)
      s = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(l))
      o = serial.command(s)
      if o == s:
          print (i + 1), 'OK', l, 'bytes'
          passed = passed + 1
      else:
          print (i + 1), 'FAIL', l, 'bytes'
          failed = failed + 1
  print 'Passed:', passed
  print 'Failed:', failed
def main():
# Start OSCServer
	print "\nStarting OSCServer. Use ctrl-C to quit."
	st = threading.Thread( target = ss.serve_forever )
	st.start()
	
	serial = Serial(port='/dev/tty.usbmodem411', rate=115200)
	passed = 0
	failed = 0
	for i in range(100000):
		l = random.randint(1, 1023)
#		s = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(l))
		s = oscString
		o = serial.command(s)
		if o == s:
			print ("arduino sez: " + o);
			print (i + 1), 'OK', l, 'bytes'
			passed = passed + 1
		else:
			print ("arduino sez: " + o);
			print (i + 1), 'FAIL', l, 'bytes'
			failed = failed + 1
	print 'Passed:', passed
	print 'Failed:', failed
Example #5
0
def main():
    serial = Serial(port='/dev/cu.usbserial', rate=115200)
    serial.command("#0 P1500 T500\n")
Example #6
0
def main():
	serial = Serial(port='/dev/cu.usbserial', rate=115200)
	serial.command("#0 P1500 T500\n")