Sample MicroPython OS functions
MicroPython provides a small list of os functions that allow you to manipulate files on the local filesystem of a MicroController.
These functions for filesystem access, and mounting, terminal redirection and duplication, and the uname and urandom functions.
These commands include:
- uname - get system information such as the release of the runtime and machine type
- listdir - list directory
- ilistdir - list all files including low-level i-node statistics
- getcwd - get current working directory
- chdir - change directory
- mkdir -
- mount/umount - mount or unmount a remote directory as a local file system
- remove - remove a file
- stat - get statistics about a file or directory
- rmdir - remove a directory
UName: Getting System Information
1 2 3 |
|
Returns:
1 2 3 4 5 6 7 |
|
Thonny does not easily allow you to delete files. To do this you will need to use the "os" functions.
1 2 3 4 |
|
To find out all the os functions use:
1 2 3 4 5 |
|
Percent Storage Full and Free RAM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Machine Clock frequency
1 |
|
returns:
1 |
|
References
https://www.youtube.com/watch?v=jnSX8ZMmHZ4