adding an SDCard Example for the ESP-Wrover-kit

master
Drew Bednar 5 years ago
parent ddfce83cb8
commit 8d7e83113b

@ -23,3 +23,5 @@ def connect():
# def no_debug():
# import esp
# esp.osdebug(None)
connect()

@ -0,0 +1,13 @@
# SD Card example
Here are the [docs for the SDCard pins](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-wrover-kit.html#get-started-esp-wrover-kit-v4-1-microsd-card-slot).
| . | ESP32 Pin | MicroSD Signal |
|---|---------------|----------------|
| 1 | MTDI / GPIO12 | DATA2 |
| 2 | MTCK / GPIO13 | CD / DATA |
| 3 | MTDO / GPIO15 | CMD |
| 4 | MTMS / GPIO14 | CLK |
| 5 | GPIO2 | DATA0 |
| 6 | GPIO4 | DATA1 |
| 7 | GPIO21 | CD |

@ -0,0 +1,20 @@
import machine, uos
# machine.SDCard(slot=1, width=1, cd=None, wp=None, sck=None, miso=None, mosi=None, cs=None)
sd = machine.SDCard()
uos.mount(sd, '/sd')
def cat(file, encoding='utf8'):
"""Prints the file."""
with open(file, mode='r', encoding=encoding) as f:
for line in f.readlines():
print(line)
def to_file(file, text='', encoding='utf8'):
"""Simple function to write some text to a file."""
with open(file, mode='r', encoding=encoding) as f:
f.write(text)

@ -1,6 +1,14 @@
export AMPY_PORT=/dev/cu.SLAB_USBtoUART
export BAUD_RATE=115200
ARG=$1
if [ "$ARG" = '--kit' ] || [ "$ARG" = '-k' ]; then
echo "Using ESP-WOVER-kit_v4.1"
export AMPY_PORT=/dev/cu.usbserial-143101
fi
function repl_connect (){
echo "Connecting to $AMPY_PORT"
screen $AMPY_PORT $BAUD_RATE

Loading…
Cancel
Save