Read-Sensor-Resistances/writerandomvalues.py

15 lines
421 B
Python
Raw Normal View History

2022-05-15 19:48:22 +00:00
from random import randint
from datetime import datetime
import json
# constant settings
a = json.load(open('settings.json', 'r'))
sens = len(a['sensor_ports'])
fileName = a["file_name"]
numberofsensors = len(a['sensor_ports'])
for i in range(1000):
f = open(fileName, 'a')
f.write(", ".join([datetime.now().strftime('%H:%M:%S')] + [str(randint(1, 1000)) for j in range(numberofsensors)]) + '\n')
f.close()