예제 #1
0
	gled.turn_on()	

def code_append(bit):
	global code, count, last
	now = datetime.now()
	if (now - last > timeout):
		print("")
		count = 0
		code = 0

	code = (code << 1) + bit
	count = count + 1
	last = now
	sys.stdout.write(str(bit))

	if count == codesize:
		code_ok(code)

def int0(interupt_bit, input_byte):
	code_append(0)

def int1(interupt_bit, input_byte):
	code_append(1)

ifm = p.InputFunctionMap()
ifm.register(6, 0, int0)
ifm.register(7, 0, int1)

print("READY")
p.wait_for_input(ifm, loop=True)
예제 #2
0
 def check_inputs(self):
     pfio.wait_for_input(input_func_map=self.ifm, loop=True)
예제 #3
0
    global code, count, last
    now = datetime.now()
    if (now - last > timeout):
        print("")
        count = 0
        code = 0

    code = (code << 1) + bit
    count = count + 1
    last = now
    sys.stdout.write(str(bit))

    if count == codesize:
        code_ok(code)


def int0(interupt_bit, input_byte):
    code_append(0)


def int1(interupt_bit, input_byte):
    code_append(1)


ifm = p.InputFunctionMap()
ifm.register(6, 0, int0)
ifm.register(7, 0, int1)

print("READY")
p.wait_for_input(ifm, loop=True)