Giter Site home page Giter Site logo

nodemcu.py's Introduction

nodemcu.py

this script can:

  • send and read data to and from the device
  • paste command sequence from clipboard
  • paste any file (binary) to the device filesystem from clipboard or file
  • has a working command history and arrow keys
  • cross-compile to bytecode using luac-cross (windows binary included in this repo)
  • compile to bytecode using string.dump on the device (survives larger files then file.compile)

it needs the following python modules

  • pyserial
  • clipboard

I'm writing this script on windows, and just occasionally check if it still works under linux.

script command line help:

usage: nodemcu.py device [boudrate]

  device should be COM(\d+) for windows
  and full device path fo unix

  boudrate if omitted is set to 9600
  can be any number or 'fast' for 460800

when the script starts and connects with nodemcu, it will show the lua interpreter prompt. You can send any lua command or use one of the build in commands:

:uart [boudrate]          - dynamic boudrate change
:load src                 - evaluate file content
:file dst src             - write local file src to dst
:paste [file]             - evaluate clipboard content
                            or write it to file if given
:cross-compile dst [file] - compile file or clipboard using
                            luac-cross and save to dst
:execute [file]           - cross-compile and execute clipboard or
                            file content without saving to flash
:soft-compile dst [file]  - compile file or clipboard on device
                            and save do dst. This call can handle
                            lager files than file.compile
By default nodemcu has uart echo turned on. This application will NOT work with echo on. Run the ":uart" command to turn it off. You have to do it every nodemcu restart or put "uart.setup(0,9600,8,0,1,0)" to init.lua

notice that the commands start with a ':'

you can use command prefixes (like ':p' or ':u')

the :uart parameter defaults to 9600 and can be 'fast' for 460800

:load and :paste evaluates commands so when you will use :p with clipboard content "print(1)\n:p" you get a beautiful loop

in the beginning of the script there is a constant LUAC_PATH. Set to point to your luac-cross binary

here are instruction how to compile luac-cross (http://www.esp8266.com/viewtopic.php?f=24&t=1305)

to exit just hit ctrl-c

nodemcu.py's People

Contributors

md5crypt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lzufalcon zxddxz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.