I'm new to Raspberry so I need a bit of help. I have a DS18B20 temperature sensor, which I want to write the measurements into a file. I have a script running, making measurement printing to screen every second, at the same time it updates the text file with the last measurement, but I would like to have all the measurements in the text file.
I'm using this script:
print(read_temp()) dataAsInt = (read_temp()) dataAsString = str(dataAsInt) fb = open("/home/pi/test2","a" '\n') fb.write(dataAsString) fb.close()
I've tryed using "a" for appending instead of writing and '\n' for writing on next line.
Hope someone can point me the right direction.