Exemple #1
0
def setText(text):
	os.system("stty speed 38400 <" + DEVICE)
	f = open(DEVICE, "w")
	print 'Writing this to badge:', text
	pkts = badge.build_packets(0x600, badge.message_file(text, speed='3', action=badge.ACTION_HOLD))
	for p in pkts:
		f.write(p.format())
	f.flush()
	f.close()
Exemple #2
0
def writeToLed(msg,spd):
	maxTextLength = 150
	if len(msg) == 0:
		msg = '...nothing to write, try fix...or reboot...'
	if len(msg) > maxTextLength:
		msg = msg[0:maxTextLength]
		print 'Shortening text'
	print len(msg), 'Writing this to led:', msg
	os.system("stty speed 38400 <" + DEVICE)
	f = open(DEVICE, "w")
	pkts = badge.build_packets(0x600, badge.message_file(msg, speed=spd, action=badge.ACTION_ROTATE))
	for p in pkts:
		f.write(p.format())
	f.flush()
	f.close()
Exemple #3
0
#-*- coding: utf-8 -*-
import os
import time

import badge

DEVICE = "/dev/ttyUSB0"
badgeMessage = "150.132.109.74"
# L = [216, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100]
# badgeMessage = ''.join(chr(i) for i in L)
os.system("stty speed 38400 <" + DEVICE)
f = open(DEVICE, "w")
pkts = badge.build_packets(0x600, badge.message_file(badgeMessage, speed='4', action=badge.ACTION_ROTATE))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #4
0
#!/usr/bin/python
import os
import subprocess
import time

import badge

DEVICE = subprocess.check_output('ls /dev/ttyUSB*', shell=True)
DEVICE = DEVICE[0:12]
MESSAGE = "Python"

os.system("stty speed 38400 <" + DEVICE + ">/dev/null")
f = open(DEVICE, "w")
pkts = badge.build_packets(
    0x600, badge.message_file(MESSAGE, speed='5', action=badge.ACTION_HOLD))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #5
0
#!/usr/bin/python
import os
import subprocess
import sys
import time

import badge

DEVICE = subprocess.check_output('ls /dev/ttyUSB*', shell=True)
DEVICE = DEVICE[0:12]
MESSAGE = sys.argv[1]
SPEED = sys.argv[2]
ACTION = sys.argv[3]

os.system("stty speed 38400 <" + DEVICE + ">/dev/null")
f = open(DEVICE, "w")
pkts = badge.build_packets(0x600, badge.message_file(MESSAGE, speed=SPEED, action=ACTION))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #6
0
#!/usr/bin/python
import os
import sys
import subprocess

import badge

DEVICE = subprocess.check_output('ls /dev/ttyUSB*', shell=True)
DEVICE = DEVICE[0:12]

os.system("stty speed 38400 <" + DEVICE + ">/dev/null")
f = open(DEVICE, "w")
pkts = badge.build_packets(
    0x600, badge.message_file(sys.argv[1], speed='1',
                              action=badge.ACTION_HOLD))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #7
0
import os
import time

import badge

DEVICE = "/dev/ttyUSB1"

os.system("stty speed 38400 <" + DEVICE)
f = open(DEVICE, "w")
pkts = badge.build_packets(0x600, badge.message_file("hello world", speed='5', action=badge.ACTION_ROTATE))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #8
0
import os
import sys

import badge

DEVICE = "/dev/ttyUSB1"

os.system("stty speed 38400 <" + DEVICE)
f = open(DEVICE, "w")
pkts = badge.build_packets(0x600, badge.message_file(sys.argv[1], speed='5', action=badge.ACTION_HOLD))
for p in pkts:
    f.write(p.format())
f.flush()
f.close()
Exemple #9
0
#!/usr/bin/python
import os
import subprocess
import sys
import time
import string

import badge

DEVICE = subprocess.check_output('ls /dev/ttyUSB*', shell=True)
DEVICE = DEVICE[0:12]
MESSAGE = raw_input("Enter message (max 250 chars): ")
SPEED = raw_input("Enter Speed (1-5): ")
ACTION = raw_input("What action? (A,B,C,D,E): ")

os.system("stty speed 38400 <" + DEVICE + ">/dev/null")
f = open(DEVICE, "w")
pkts = badge.build_packets(
    0x600, badge.message_file(MESSAGE, speed=SPEED, action=ACTION))

for p in pkts:
    f.write(p.format())
f.flush()
f.close()