File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
# SPDX-FileCopyrightText: 2021 Alec Delaney
2
2
# SPDX-License-Identifier: MIT
3
3
4
+ import board
5
+ import busio
6
+ from digitalio import DigitalInOut
7
+ import storage
8
+ import adafruit_sdcard
4
9
import adafruit_logging as logging
5
10
6
- # Initialize log functionality on a writable medium, like an SD card
11
+ # Get chip select pin depending on the board, this one is for the Feather M4 Express
12
+ sd_cs = board .D10
13
+
14
+ # Set up an SD card to write to
15
+ spi = busio .SPI (board .SCK , board .MOSI , board .MISO )
16
+ cs = DigitalInOut (sd_cs )
17
+ sdcard = adafruit_sdcard .SDCard (spi , cs )
18
+ vfs = storage .VfsFat (sdcard )
19
+ storage .mount (vfs , "/sd" )
20
+
21
+ # Initialize log functionality
7
22
log_filepath = "/sd/testlog.log"
8
23
logger = logging .getLogger ("testlog" )
9
24
file_handler = logging .FileHandler (log_filepath )
You can’t perform that action at this time.
0 commit comments