#!/usr/bin/env python3
import sensor
import time

addr = 247
baud = 19200
output_file = 'log'

s = sensor.Sensor(address=addr, baudrate=baud)
while True:
    with open('log','a+') as f:
        values = f'{time.time():.2f} '
        for reg_name, reg_number in sensor.Sensor.input_registers.items():
            values += f'{int(s.read_register(reg_number))} '
        values += '\n'
        f.write(values)
    time.sleep(10)
