def transmit(transfer): TX = 25 BPS = 2000 pi = pigpio.pi() tx = vw.tx(pi, TX, BPS) start = time.time() print transfer while not tx.ready(): time.sleep(0.1) tx.put(transfer) time.sleep(0.2) tx.put(transfer) tx.cancel() pi.stop()
import vw CONFIG = ml.read_config() NAME = 'codesend' LOGFILE = 'debug' LOGGER = ml.init_logging(NAME, LOGFILE) try: TX = int(CONFIG.get("vw", "TX_Code")) BPS = int(CONFIG.get("vw", "BPS")) PI = pigpio.pi() # Connect to local Pi. TX = vw.tx(PI, TX, BPS) # Specify Pi, TX GPIO, and baud. CONFIG = ' TX:' + str(TX) + ' BPS:' + str(BPS) LOGGER.warning('codesend has started with CONFIG. >> ' + CONFIG) while TX.ready(): # TX.put("{:s}".format(sys.argv[1])) R_VALUE = "{:s}".format(sys.argv[1]) R_VALUE_LEN = len(R_VALUE) # print(R_VALUE) LOGGER.debug('R_VALUE : ' + R_VALUE + ' length : ' + str(R_VALUE_LEN))
#!/usr/bin/env python # -*- coding: latin-1 -*- import time import pigpio import vw BPS = 2000 pi = pigpio.pi() tx = vw.tx(pi, 25, BPS) compteur = 0 start = time.time() while (time.time() - start) < 2: compteur += 2 while not tx.ready(): time.sleep(0.1) time.sleep(0.2) while not tx.ready(): time.sleep(0.1) time.sleep(0.2) tx.put("0") exit() tx.cancel() pi.stop()
import time import pigpio import vw RX=11 TX=25 BPS=2000 pi = pigpio.pi() # Connect to local Pi. rx = vw.rx(pi, RX, BPS) # Specify Pi, rx gpio, and baud. tx = vw.tx(pi, TX, BPS) # Specify Pi, tx gpio, and baud. msg = 0 start = time.time() while (time.time()-start) < 300: msg += 1 while not tx.ready(): time.sleep(0.1) time.sleep(0.2) tx.put([48, 49, 65, ((msg>>6)&0x3F)+32, (msg&0x3F)+32])
if __name__ == "__main__": import time import pigpio import vw RX=20 TX=25 BPS=2000 pi = pigpio.pi() # Connect to local Pi. rx = vw.rx(pi, RX, BPS) # Specify Pi, rx GPIO, and baud. tx = vw.tx(pi, TX, BPS) # Specify Pi, tx GPIO, and baud. msg = 0 start = time.time() while (time.time()-start) < 300: msg += 1 #while not tx.ready(): # time.sleep(0.02) #time.sleep(0.1) #tx.put("{:04d}".format(msg))
def __init__(self): self.ledcom_pi = pigpio.pi() self.ledcom_tx = vw.tx(self.ledcom_pi, LED_COM_TX, LED_COM_BPS)
def sendToPuck(number_str): "Envoie un message au palet numero 'number_str'" for x in range(0,5): while not tx.ready(): time.sleep(0.1) time.sleep(0.1) tx.put("SB"+number_str+"F") print "\t\tTerminé !" """ Initialisation des variables """ TX = 25 # pin GPIO data emetteur RF BPS = 1000 # vitesse en bauds pi = pigpio.pi() tx = vw.tx(pi, TX, BPS) #pins pour le clavier numerique cols = [4, 3, 2] #pins colones rows = [10, 22, 27, 17] # pins lignes current_value = "" for col in cols: pi.set_mode(col, pigpio.INPUT) pi.set_pull_up_down(col, pigpio.PUD_UP) pi.set_glitch_filter(col, 2500) for row in rows: pi.set_mode(row, pigpio.OUTPUT) pi.write(row, 0)
import time import pigpio import vw RX=20 TX=1 BPS=20000 pi = pigpio.pi() # Connect to local Pi. #rx = vw.rx(pi, RX, BPS) # Specify Pi, rx GPIO, and baud. tx = vw.tx(pi, TX, BPS) # Specify Pi, tx GPIO, and baud. msg = 0 start = time.time() while (time.time()-start) < 300: msg += 1 while not tx.ready(): time.sleep(0.02) time.sleep(0.1) tx.put("{:04d}".format(msg)) while not tx.ready(): time.sleep(0.02) time.sleep(0.1) tx.put("Hello World #{:04d}!".format(msg))
import time import pigpio import vw RX = 11 TX = 25 BPS = 2000 pi = pigpio.pi() # Connect to local Pi. rx = vw.rx(pi, RX, BPS) # Specify Pi, rx gpio, and baud. tx = vw.tx(pi, TX, BPS) # Specify Pi, tx gpio, and baud. msg = 0 start = time.time() while (time.time() - start) < 300: msg += 1 while not tx.ready(): time.sleep(0.1) time.sleep(0.2) tx.put([48, 49, 65, ((msg >> 6) & 0x3F) + 32, (msg & 0x3F) + 32])