Exemplo n.º 1
0
 def close(self):
     if config[botname]["type"] == "dev":
         self.dev.close()
     elif config[botname]["type"] == "file":
         self.f.close()
     elif config[botname]["type"] == "spi":
         spi.end()
     elif config[botname]["type"] == "socket":
         self.socket.close()
Exemplo n.º 2
0
import sys
import spi

spi.initialize(0,32,250000,0)
str=sys.argv[1]
crc = 0
for b in sys.argv[1]:
	crc += ord(b)
crc &= 0xFF
print("CRC:",crc)
list_c = tuple(map(ord,list(str))+[crc,10])
print list_c
spi.transfer(list_c)
spi.end()