可以连接maixpy,但是点击运行以后过一会就断开连接了,没有报错,没爆内存。
运行下面的代码修改存在Flash上的 config.json 的板子引脚信息。
fpioa映射时用到这些引脚信息,到时直接查原理图也行,也可以运行下面的代码,会将config.json自动保存在Flash中。
import json
config = {
"type": "bit",
"board_info": {
'LED0':0,
'LED1':1,
'BOOT_KEY': 16,
'LED_R': 6,
'LED_G': 7,
'LED_B': 8,
'MIC0_WS': 33,
'MIC0_DATA': 34,
'MIC0_BCK': 32,
}
}
cfg = json.dumps(config)
print(cfg)
try:
with open('/flash/config.json', 'rb') as f:
tmp = json.loads(f.read())
print(tmp)
if tmp["type"] != config["type"]:
raise Exception('config.json no exist')
except Exception as e:
with open('/flash/config.json', "w") as f:
f.write(cfg)
import machine
machine.reset()