47e497e7
lahouass
Enregistrement de...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!usr/bin/env python
import serial
from lxml import etree
xml = etree.parse('111-1.xml')
ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1)
value = ser.readline()
for parametre in xml.getchildren():
if 'name' in parametre.attrib and parametre.attrib['name'] == 'data':
parametre.text = value
with open('111-1.xml', 'w') as myFile:
myFile.write(etree.tounicode(xml))
myFile.close
|