calmera / micropyos

Small os for MicroPython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

micropyos

Small os for micropython

This small os i made to work out how to use the micropython commands for wifi network ect. you can copy files to and from a remote computer using scp and cal also get files from the internet with the wget command.

How to run micropyos
copy micropyos.py and settings.py to your esp flash

edit settings.py below

import uos
'''
Settings file for micropyos

'''

# Remote ip of the ssh server to scp to
remoteIP= '192.168.0.3'		<- Set ip address of the server to connect to
# path to scp to and from
remotePath='/Users/thecodeman/Projects/micropyos/'	<- Set path on server
# username on server for scp
uname='username'			<- User Name for server
upass='password'			<- Password for server
# wifi username and password 
wifiSSID = 'ssid'			<- WiFi SSID
wifiPass = 'wifipassword' 	<- WiFi Password
wifiTimeout = 50
# username and password for telnet server 
telnetUname = 'micropyos'	<- User Name for telnet server on MicroPython 
telnetPass = 'esp32'		<- User Password for telnet server on MicroPython 

# name for nDNS so you can connect remotely using name 
# using name below you  can telnet to myesp32.local or ping myesp32.local to get devices ip address
networkName = 'myesp32' 	<- nDNS Name
# your time zone
timeZone= 'PST8PDT'

# Autostart options
autostartWiFi = True	
autoMountSD = True
autoStartTelnet = True
autoStartmDNS = True

sdCardCLK = 4
sdCardMOSI = 12
sdCardMiso = 2
sdCardCS =15

def initSDCard():
#	uos.sdconfig(uos.SDMODE_4LINE, sdCardCLK , sdCardMOSI, sdCardMiso, sdCardCS)
	uos.sdconfig(uos.SDMODE_4LINE)
	try:
	    uos.mountsd()
	except Exception as e:
	    print(e)

Once you get the settings file done just

import micropyos

Commands:

ls - list files current directory
lr - list files on remote server (optional directory)
cat - display contents file
rm - remove file
df - display drive space
time - display time and date
get - scp from server
put - scp to server
md - make directory
rmdir - remove directory
run - run python script
edit - edit file using pye
modules - list installed modules
reset - reset board
wget - get file over http and save to file
cp - copy files local

WiFI Connecting To UpTheIRONS

Connected  ('192.168.0.18', '255.255.255.0', '192.168.0.1', '209.18.47.62')

 Mode:  SD (4bit)
     Name: SD02G 
     Type: SDSC 
    Speed: default speed (25 MHz) 
     Size: 1886 MB 
      CSD: ver=0, sector_size=512, capacity=3862528 read_bl_len=10 
      SCR: sd_spec=2, bus_width=5 

Time set to: Wed Dec 31 16:00:08 1969 
 __   __  ___   _______  ______    _______  _______  __   __  _______  _______ 
|  |_|  ||   | |       ||    _ |  |       ||       ||  | |  ||       ||       | 
|       ||   | |       ||   | ||  |   _   ||    _  ||  |_|  ||   _   ||  _____| 
|       ||   | |       ||   |_||_ |  | |  ||   |_| ||       ||  | |  || |_____ 
|       ||   | |      _||    __  ||  |_|  ||    ___||_     _||  |_|  ||_____  | 
| ||_|| ||   | |     |_ |   |  | ||       ||   |      |   |  |       | _____| | 
|_|   |_||___| |_______||___|  |_||_______||___|      |___|  |_______||_______| 
small OS for micropython ver 0.1.0 by theCodeman 
https://github.com/TheCodeman/myos 
MicroPython Version : 3.4.0 Platform : esp32_LoBo 
/flash> 
/flash>help 
Command List 
---------------------------------- 
ls      - list files current directory 
lr      - list files on remote server optional directory 
cat     - display file 
rm      - remove file 
df      - display drive space 
time    - display time and date 
get     - scp from server 
put     - scp to server 
md      - make directory 
rmdir   - remove directory 
run     - run python script 
edit    - edit file using pye 
modules - list installed modules 
reset   - reset board 
wget    - get file over http and save to file 
---------------------------------- 
/flash> 

Commands:

ls - list current directory

/flash>ls
Current Directory  /flash
Type    Size    Filename
----------------------------------
F       174              boot.py
F       1366             lora.py
F       7648          tftDemo.py
F       483          settings.py
F       899              main.py
F       319            update.py
F       13174       micropyos.py
----------------------------------

lr - list remote directory

D       238     .
D       1700    ..
D       510     .git
F       409     .gitattributes
F       13526   micropyos.py
F       2876    README.md
F       479     settings.py

cat - type contents of file

/flash>cat boot.py
# This file is executed on every boot (including wake-boot from deepsleep)

import sys

# Set default path
# Needed for importing modules and upip
sys.path[1] = '/flash/lib'

rm - delete file

df - show disk space used and free space

/flash>df
File System Size 2,161,152 - Free Space 2,134,528

get - get file from remote and save to current directory

put - put file to remote

md - make directory on current drive

rmdir - remove directory

cd - change directory

wget - get file using http and save to current directory

reset - reset board

time - display current time and date

/flash>time
Time set to: Thu Sep  6 19:32:09 2018

cp - copy files between directorys or to new name

/flash/cp main.py /sd/main.py
/flash/cp main.py test.py

mountsd - mount sd card

umountsd - unmount sd card

help - display some help

/flash>help
Command List
----------------------------------
ls      - list files current directory
lr      - list files on remote server optional directory
cat     - display file
rm      - remove file
df      - display drive space
time    - display time and date
get     - scp from server
put     - scp to server
md      - make directory
rmdir   - remove directory
run     - run python script
edit    - edit file using pye
modules - list installed modules
reset   - reset board
wget    - get file over http and save to file
----------------------------------

run - run python file

edit - runs pye editor with filename

About

Small os for MicroPython


Languages

Language:Python 100.0%