1'''
2SDCard - Read from SD Card.py.
3
4This example demonstrates how to read from txt file.
5
6For other examples please check:
7 https://github.com/WPC-Systems-Ltd/WPC_Stand-alone_Python_release/tree/main/examples
8
9Copyright (c) 2025 WPC Systems Ltd.
10All rights reserved.
11'''
12
13import pywpc_sd
14
15## Initialize the SD card
16dev = pywpc_sd.SDCard()
17
18## Debug print SD card directory and files
19print(dev.getFileDirectory())
20
21## Open the file in "read mode".
22## Read the file and print the text on debug port.
23dev.openFile("sample.txt", "r")
24
25## Reading from SD card
26print(dev.readStringFromFile())
27
28## Close the file
29dev.closeFile()