EzData 2.0 is an IoT cloud data storage service provided by M5Stack, allowing different devices to insert or extract data into a storage queue through a unique token, enabling data sharing.
import os, sys, io
import M5
from M5 import *
from ezdata import *
ez_0 = None
ez_item = None
def setup():
global ez_0
M5.begin()
Widgets.fillScreen(0x222222)
ez_0 = EzData('b1112ac5e9644f26af381c15c4a0e1da', 'age')
ez_0.set("res/img/default.png", is_file=True)
def loop():
global ez_0
M5.update()
ez_0.set(18, is_file=False)
print(ez_0.get())
ez_0.set([1, 2, 3], is_file=False)
print(ez_0.history())
ez_0.delete()
for ez_item in get_key_list(device_token=_).iterms():
print(ez_item[0])
print(ez_item[1])
if __name__ == '__main__':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")
ez_0 = EzData('b1112ac5e9644f26af381c15c4a0e1da', 'age')
ez_1 = EzData('b1112ac5e9644f26af381c15c4a0e1da', 'hello_M5')
ez_4 = EzData('b1112ac5e9644f26af381c15c4a0e1da', '', public=True)
ez_3 = EzData('795efd86c2a6478eb9c3bb414376bb6b', 'age')
ez_0.set(18, is_file=False)
ez_0.set({'hello_M5':'hello M5'}, is_file=False)
ez_0.set([1, 2, 3], is_file=False)
ez_0.set({'hello_M5':'hello M5'}, is_file=False)
ez_0.set("res/img/default.png", is_file=True)
ez_0.set("res/img/default.png", is_file=True)
ez_0.get_file('helloM5.png')
print(ez_0.get_update_time())
print(ez_0.get())
print(ez_0.has_new_data())
print(ez_0.history())
for ez_item in get_key_list(device_token=_).iterms():
print(ez_item[0])
print(ez_item[1])
ez_0.delete()