Bonsoir à tous,
Je poste ici car je séche un peu.
Mon code :
mon programme boucle bien mais je n'ai pas de données transmise sur le port serie.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #!/usr/bin/env python # print ("Starting program") import serial #import MAX3100 as COM import time # import string # count = 1 myin = "1" test=serial.Serial("COM6",9600,timeout=5) test.close() test.open() teststring = "5" # try: while True: print (count, teststring) test.write(int(myin))<-----pb print ("Waiting 5 second") time.sleep(5) #myin = test.readline() #print("recieved :"+myin) count = count + 1 # except KeyboardInterrupt: pass # do cleanup here # test.close()
J'ai lu qu'il fallait que les données soit transmise en ascii.
Grace au code string.encode('ascii') mais je ne sais pas comment l'utiliser.
si quelqu'un pouvais m'aider, ce serais sympas.
merci d'avance
Stéphane








Répondre avec citation
Partager