Home

Awesome

<p align="center"> <a href="https://github.com/gepd/uPiot-MicroPython-Tool/releases"><img src="https://img.shields.io/github/release/gepd/uPiot-MicroPython-Tool.svg?maxAge=3600&style=flat-square" alt="Release"></a> <a href="https://packagecontrol.io/packages/uPiot-MicroPython-Tool"><img src="https://img.shields.io/packagecontrol/dt/uPiot-MicroPython-Tool).svg?maxAge=3600&style=flat-square" alt="Downloads"></a> <a href="https://github.com/gepd/uPiot-MicroPython-Tool/blob/master/LICENCE"><img src="https://img.shields.io/badge/Licence-%20MIT-green.svg?maxAge=3600&style=flat-square" alt="Licence"></a> <a href="https://gratipay.com/~gepd/"><img src="https://img.shields.io/badge/donate-uPiot-red.svg?maxAge=3600&style=flat-square" alt="Donate"></a> </p>

uPiot - MicroPython Tool

<p align="center"> <img src="docs/upiot_main.png"> <p align="center" style="font-size: 9pt">Sublime theme used: <a href="https://github.com/ihodev/sublime-boxy">Boxy</a></p> </p>

uPiot is an experiment to make the work with uPython (micropython) a little bit easier. It uses an modified version of ampy called sampy (Sublime + ampy) to comunicate with the device and pyserial to listen for changes. You can also burn the firmware direct from Sublime Text without any extra tool.

This plugin is in alpha state, so you may find some bugs hanging around. Help me to improving it opening a issue with your repport or with a PR.

Setup

uPiot is not yet in the Package control, so you may need an extra step to install it.

  1. Go to Preferences > Package Package Control > Add Repository
  1. Press ctrl+shift+p or go to ST Menu > Preferences > Package Control and select the option Package Control: Install Package

  2. Search for upiot and install it.

Getting Started

Use the shortcut ctrl+alt+m to see all available uPiot options in the command menu.

Burn the firmware

<img src="docs/download_firmware.gif" width="85%">
  1. From the command menu select UPIOT: Download Firmware

  2. Go to http://micropython.org/download and copy the link of the esp8266 or esp32 firmware (I've tried the plugin only in this boards) and paste it in the input panel in Sublime Text.

<img src="docs/burn_firmware.gif" width="85%">
  1. After the download is finished opens the command menu again and select UPIOT: Burn Firmware.

When it is finished, you will be ready to use micropython in your device.


Using micropython

<img src="docs/console_hello_world.gif" width="85%">

To use micropython opens the console with the option UPIOT: Open Console (from the command menu). In the input panel paste print("Hello world from uPiot"). If everything is fine you will see Hello world from uPiot

Micropython try to run main.py each time your board is powered on (or reseted), when you don't have this file you will see OSError: [Errno 2] ENOENT: main.py in the output.

<img src="docs/run_current_file.gif" width="85%">

Make a new file and save it as main.py, writes print("Hello world from uPiot") on it and send it to your device with the command UPIOT: Put Current File (You can use UPIOT: Run Current File in case you want to test it first) after it finished, restart your board; the error won't be there and you should see the Hello world from uPiot in the output.

<img src="docs/put_current_file.gif" width="85%">

Commands

That are the current list of commands availables in the console.

<img src="docs/sampy_example.gif" width="85%">

Usage: sampy COMMAND [ARGS]

CommandDescription
lsList the contens on the board
run file_nameRun a script and print it's output
get file_nameRetrieve a file from the board
put file_namePut a file or folder and its contents on the board
rm file_nameRemove a file from the board
mkdir folder_nameCreate a directory on the board
rmdir folder_nameForcefully remove a folder and all its content from board
resetPerform soft reset/reboot of the board
--helpShows this information

Note that if you don't write prefix 'sampy' in the console the string will be sent as a raw text to the device (with the \r\n ending)

List of options available in the command menu. (ctrl+alt+m)

OptionDescription
Burn FirmwareBurn a micropython firmware in the selected device. Read More
Download FirmwareDownload a firmware from http://micropython.org/download and store it in your machine. This file will be used with the Burn Firmware option
List Files in DeviceShows all file in the device
Erase FlashErase the memory flash of your device. You will be promt to erase the memory flash of your device before burn the firmware
Make FolderMake a folder in the selected device (you can choose the device from Select Serial Port)
Open ConsoleOpens the console to interact with the device, before open it selec the device inSelect Serial Port
Put FilePuts the given file in the device. You need to give it the absolute path to this option work
Remove FileRemoves the given file in the device
Remove FolderRemoves a folder from the device
Put Current FilePuts the focused file your device
Run Current FileRuns the focused file your device
Select Serial PortSelects the serial port to be used in the Console or Burn Firmware command
Cancel (Ctrl + C)Sends a cancel string to the open serial port (\x03)
Write in ConsoleSends an string through the serial port. You can also use the [Console commands]
Sync File From DeviceSearch all files in your device and save it in the given location
HelpOpens this github

Shortcuts

At this moment, there is 4 importantant shorcuts:

I haven't test the shortcuts in all platforms, if you have any problem open a issue

Donate

Support the open source!. If you liked this plugin, and you want to make a contribution to continue its development, do it through this link. If you have any problems, or want to contact me: gepd@outlook.com

License

Copyright 2017 GEPD gepd@outlook.com

uPiot is licensed under MIT license. Read the full License file.

Note that may be some dependencies under a different license