correcciones

This commit is contained in:
Sergio Pernas 2022-04-05 17:56:40 -03:00
parent fbd5edd62b
commit 0d80d649b3
2 changed files with 5 additions and 4 deletions

View file

@ -6,7 +6,7 @@ import sys
ser = serial.Serial( ser = serial.Serial(
port='/dev/serial0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0 port='/dev/serial0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0
baudrate = 14400, baudrate = 9600,
parity=serial.PARITY_NONE, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS, bytesize=serial.EIGHTBITS,
@ -22,7 +22,7 @@ ser.flush()
while True: while True:
if ser.in_waiting > 0: if ser.in_waiting > 0:
line = ser.readline().decode('utf-8', errors='replace').rstrip() line = ser.readline().decode('utf-8', errors='replace').rstrip()
time.sleep(0.5) #time.sleep(0.1)
print(line) print(line)
ser.flush() ser.flush()
break break

View file

@ -37,13 +37,14 @@ funcion_datos_simulados() {
funcion_datos_sensores() { funcion_datos_sensores() {
peticiones=1 peticiones=1
arduinos=( 0x01 0x02 ) arduinos=( 1 2 )
for arduino_id in ${arduinos[@]};do for arduino_id in ${arduinos[@]};do
lectura_arduino=($(timeout 3 $arduinos_py $arduino_id)) lectura_arduino=($(timeout 3 $arduinos_py $arduino_id))
let "bloques = (${#lectura_arduino[@]} - 1) / 4" let "bloques = (${#lectura_arduino[@]} - 1) / 4"
lecturas="$lecturas id:${lectura_arduino[0]}" #lecturas="$lecturas id:${lectura_arduino[0]}"
lecturas="$lecturas id:${arduino_id[0]}"
indice=1 indice=1
vueltas=1 vueltas=1