Hi Group,
I would like to know how is possible set the correct date when i create a new file , in order to store values that i'm sensing with a sensor.
#========================================
archivo=open('/sd/archivo.txt','w')
archivo.write('{},{},{},{},{},{},{}\n'.format(t,xm,ym,zm,xg,yg,zg))
#========================================
Which part of the code must I have set the time or date characteristic?
Is it possible to preserve on memory the correct time?, and the next time i rund code ,it sets the correct datetime?
Set the correct Date at creating a nwe File Document
-
- Posts: 5
- Joined: Fri Nov 18, 2016 10:05 pm
- Contact:
Set the correct Date at creating a nwe File Document
((( Diego Cuba Z )))
Re: Set the correct Date at creating a nwe File Document
Perhaps the RTC module will be of help: http://docs.micropython.org/en/latest/p ... C.datetime
Re: Set the correct Date at creating a nwe File Document
And in order to preserve the RTC date/time across power cycles, you'll need to add a small coin cell battery. Typically a CR2032.
On the original pyboard (V1.0) connect the + side of the battery to the VBAT, and the - side to GND. On the newer pyboards (V1.1) use the VBACK and GND pins (VBAT on the newer boards refers to a battery for powering the board).
On the original pyboard (V1.0) connect the + side of the battery to the VBAT, and the - side to GND. On the newer pyboards (V1.1) use the VBACK and GND pins (VBAT on the newer boards refers to a battery for powering the board).