I am using a ESP32 dev kit board to run a simple wi-fi server using miropython. I would like to periodically store some values in the onboard flash memory. I have therefore created and added the file "config.json" to the ESP32, which contains the following:
Code: Select all
{
"aa1":" ",
"aa2":" ",
"aa3":" ",
"bb1":" ",
"bb2":" ",
"bb3":" ",
"cc1":" ",
"cc2":" ",
"cc3":" ",
"dd1":" ",
"dd2":" ",
"dd3":" ",
"ee1":" ",
"ee2":" ",
"ee3":" "
}
Code: Select all
import json
with open('config.json') as f:
config = json.load(f)
a1 = config['aa1']
a2 = config['aa2']
a3 = config['aa3']
b1 = config['bb1']
b2 = config['bb2']
b3 = config['bb3']
c1 = config['cc1']
c2 = config['cc2']
c3 = config['cc3']
d1 = config['dd1']
d2 = config['dd2']
d3 = config['dd3']
e1 = config['ee1']
e2 = config['ee2']
e3 = config['ee3']
Code: Select all
config['aa1'] = a1
config['aa2'] = a2
config['aa3'] = a3
config['bb1'] = b1
config['bb2'] = b2
config['bb3'] = b3
config['cc1'] = c1
config['cc2'] = c2
config['cc3'] = c3
config['dd1'] = d1
config['dd2'] = d2
config['dd3'] = d3
config['ee1'] = e1
config['ee2'] = e2
config['ee3'] = e3