1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| while 1: #Voir que faire pour l'arrêt' #Test de réception'
print("li")
Ligne=[]
print("fl")
radio.flush_tx()
radio.flush_rx()
print("list")
radio.startListening()
print("ev")
GPIO.add_event_detect(irq_gpio_pin, GPIO.FALLING, callback=GPIO_NRF_Int, bouncetime=75)
print("attente")
time.sleep(30)
radio.stopListening()
print("rm")
GPIO.remove_event_detect(irq_gpio_pin)
#Emission si nécessaire
print("op")
f=open(ChFiEm,"rb")
print("rd")
cs=csv.reader(f,delimiter=',',quotechar='"',quoting=csv.QUOTE_NONNUMERIC,lineterminator="\r\n")
for line in cs:
print("ap")
Ligne.append(map(int,line))
print("cl1")
while(not f.closed):
f.close()
time.sleep(1)
print("rm")
f=open(ChFiEm,"wb")
#f.truncate()
print("cl2")
while(not f.closed):
f.close()
time.sleep(1)
for line in Ligne:
print("ligne")
while(not Datagl==line):
Datagl=[line[0]]
#Test si Heure ou tableau d'activation.'
if len(line)==3:
#Emission heure
Emission(line[0],line[-2:])
elif len(line)==7:
#Tableau d'activation'
Emission(line[0], line[-6:])
#Test de bonne émission'
radio.flush_tx()
radio.flush_rx()
radio.startListening()
GPIO.add_event_detect(irq_gpio_pin, GPIO.FALLING, callback=GPIO_NRF_Int, bouncetime=75)
time.sleep(2)
radio.stopListening()
GPIO.remove_event_detect(irq_gpio_pin)
print('Data:',Datagl,'line',line)
Datagl=[-1] |
Partager