I’m new in programming with python.
I have a problem with Wipy. I use Wipy to read data from an IMU (BNO055):
-I put float data in a list,
I convert this list in a string with the command ‘repr’,
I save the list in a file.txt that I opened before and with the command ‘write’ I put the list on it
Now the program create the file but it is empty.
Then I open the same file in mode ‘r’, I use the command ‘read’ to read file and I print the content of my file.
It print the list of float that I put inside the file before, but if I try to open my file it is empty.
Can you help me?
HERE THE CODE THAT I WROTE
from machine import Timer
from machine import I2C
from machine import PWM
Use command from my library to extract data from BNO055
for i in range(0,10):
eul = lib_imu.get_euler()
if i > 5:
open file in mode to write on it
file_dati = open(“dati_posizione.txt”, “w”)
f = open(“dati_posizione.txt”, “r”)
HERE WHAT IT PRINT
result [0.0, 176.9375, 176.9375, 176.9375, 176.9375, 176.9375, 176.9375]