pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

EEPROM

案例程序

写入变量进入EEPROM,并显示在屏幕

from m5stack import *
from m5stack_ui import *
from uiflow import *
import nvs

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)

label0 = M5Label('label0', x=137, y=88, color=0x000, font=FONT_MONT_14, parent=None)

nvs.write(str('q'), '1')
while True:
  label0.set_text(str(nvs.read_str('q')))
  wait_ms(2)

功能说明

nvs.write(str(''), '')
  • 初始化EEPROM,设置变量,并赋值
str(nvs.read_str('q'))
  • 读取EEPROM的变量
str(nvs.read_int('q'))
  • 将EEPREOM的变量转化为整型输出
On This Page