Git Product home page Git Product logo

nodemcu-and-javascript's Introduction

NodeMCU board (ESP8266) with JavaScript

This repository provides a little introduction into getting going with the NodeMCU board (1.0/v2) and Espruino (JavaScript for Microcontrollers, v1.87). It provides an installation guide and some examples.

Examples

Title Description
Hello World A simple Hello World example
Blink A simple example to flash the integrated LED
Wi-Fi A simple example to connect to a Wi-Fi AP and make the NodeMCU board available through espruino.local
HTTP Server A simple Web Server to control the integrated LED

Installation

I spent 2-3 days to make everything working, so I decided to provide a compressed folder (esptool.py v1.2 & Espruino v1.87) with everything you need to flash the firmware.

You probably need to install pyserial for using the esptool.py. It can be achieved with sudo easy_install pyserial(macOS), sudo apt-get install python-serial(Linux) or sudo pip install pyserial.

Move inside the downloaded folder

cd Downloads
cd Espruino_v1_87

Erase the flash memory

python esptool.py --port /dev/tty.SLAB_USBtoUART erase_flash

Erase flash

Flash the NodeMCU with Espruino

python esptool.py  --port /dev/tty.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_freq 80m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin

Flash firmware

After flashing the firmware, you may have to unplug/plug the NodeMCU to the computer. To test the installation process, you can use Screen and send some JavaScript code, like process.memory()or digitalWrite(NodeMCU.D4, HIGH); to turn on the built-in led.

screen /dev/tty.SLAB_USBtoUART 115200

Screen

Launch Google Chrome, install the Espruino Web IDE (extension) and modify the Baud Rate to 115200 (Espruino Web IDE > Settings > Communications > Baud Rate).

Espruino Web IDE

It's possible to program the board Over-The-Air by defining a hostname and configuring a connection to it. Use the Wi-Fi example and add its hostname espruino.local:23 in the configuration (Espruino Web IDE > Settings > Communications > Connect over TCP Address).

Sources

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

nodemcu-and-javascript's People

Contributors

smrtnt avatar

Watchers

James Cloos avatar Napat Rungruangbangchan avatar

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.