def leer(N):
    import serial
    N= int(N)
    sensor = serial.Serial('/dev/ttyACM0', timeout = 30)
    
    sensor.write("\x16T\r")
    
    
    lectura = sensor.read(N)
    buf = sensor.inWaiting()
    
    print(buf)
    print(type(buf))
    print(lectura)
    print(type(lectura))
    print(len(lectura))
    if(buf == 0):
        print("lectura correcta")
    if(buf > 0 ):
        print("lectura incorrecta")

    
    sensor.close()
leer(15)
print("fuera")
