Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 265 → Rev 266

/PIC Stuff/Cerebot_32MX7_LED_Cube/Ethernet API/cube.py
87,7 → 87,7
payload = txFrame + txOpcode + txColorCh.decode('hex') + txData.decode('hex')
sock.send(payload)
 
def cube_update_text(string, r, g, b, update_rate):
def cube_update_text_scrolling(string, r, g, b, update_rate):
'''Sets the scrolling text on the cube.'''
txFrame = struct.pack("!6s6sH", dst_addr, hw_addr, len(string) + 6)
txOpcode = "20".decode('hex')
95,6 → 95,21
txString = string.encode('hex')
sock.send(txFrame + txOpcode + txData.decode('hex') + txString.decode('hex'))
 
def cube_update_text_static(string, r, g, b):
'''Sets the static text on the cube.'''
txFrame = struct.pack("!6s6sH", dst_addr, hw_addr, len(string) + 5)
txOpcode = "21".decode('hex')
txData = ''.join("%02x%02x%02x%02x" % (len(string), r, g, b))
txString = string.encode('hex')
sock.send(txFrame + txOpcode + txData.decode('hex') + txString.decode('hex'))
 
def cube_update_text_insert(character, r, g, b):
'''Appends a character to the beginning of the text buffer.'''
txFrame = struct.pack("!6s6sH", dst_addr, hw_addr, 5)
txOpcode = "22".decode('hex')
txData = ''.join("%02x%02x%02x%02x" % (r, g, b, character))
sock.send(txFrame + txOpcode + txData.decode('hex'))
 
def cube_update_waterfall(c0, c1, c2, c3, c4, c5, c6, c7):
'''Fills in one row and shifts rows by one.'''
txFrame = struct.pack("!6s6sH", dst_addr, hw_addr, 9)