Inside Flash

We recommend file system to freshman because inside of flash has stored micro-python hardware, flash file system and system parameter. However, if you know about the storage area, you can operate flash by related api of the module esp.

SD card

Here we presented the use of sd card. (The support of current micro-python to sd card is not well-developed, some still cannot be identified.)
The purchasing link of MicroSD Module will be published soon.
Please change D4 of the switch to on, others to off.

Hardware connection effect image:

Example code: Examples=>Storage=>sd.py

Example code for ESP8266:

#hardware platform:FireBeetle-ESP8266

from machine import SPI,Pin
import sdcard
import os
spi = SPI(baudrate=100000, polarity=1, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
sd = sdcard.SDCard(spi, Pin(2))

os.mount(sd,"/sd")
fd=open('/sd/dfrobot.txt','rw')
fd.write('hello dfrobot')
fd.seek(0)
print(fd.read())
fd.close()
print(os.listdir('/sd'))
os.umount("/sd")

The operation effect:

EEPROM

Hardware platform: ESP32, ESP8266

Hardware connection

Example code:Examples=>Storage=>eeprom.py

#hardware platform:FireBeetle-ESP8266

import time
from machine import Pin,I2C
i2c = I2C(scl=Pin(5),sda=Pin(4), freq=100000)
b=bytearray("dfrobot")
i2c.writeto_mem(0x50,0,b,addrsize=16)
time.sleep(0.1)
print(i2c.readfrom_mem(0x50,0,7,addrsize=16))

results matching ""

    No results matching ""