Giter Club home page Giter Club logo

esp32quickjs's Introduction

QuickJS Javascript Engine

The main documentation is in doc/quickjs.pdf or doc/quickjs.html.

Build with platform.io (ESP32)

Exampes: https://github.com/binzume/esp32quickjs-examples

platformio.ini

add git url to lib_deps.

lib_deps = 
	https://github.com/binzume/esp32quickjs.git

main.cpp

include esp/QuickJS.h.

#include <Arduino.h>
#include "esp/QuickJS.h"

static const char *jscode = R"CODE(
  console.log('Hello, JavaScript!');
)CODE";

M5QuickJS qjs;

void setup() {
  Serial.begin(115200);
  qjs.begin();
  qjs.exec(jscode);
}

JavaScript API

  • console.log(string)
  • setTimeout(callback, ms) : int
  • setInterval(callback, ms) : int
  • clearTimeout(id)

esp32 module

  • esp32.millis() : int
  • esp32.digitalRead(pin) : int
  • esp32.digitalWrite(pin, value) // value=0: LOW, 1: HIGH
  • esp32.pinMode(pin, mode) // mode=1: INPUT, 2: OUTPUT
  • esp32.setLoop(func) // func is called every arduino loop().
  • esp32.deepSleep(us) // not returns

if WiFi.h is included:

  • esp32.isWifiConnected() : bool
  • esp32.fetch(url, {method:string, body:string}): Promise<{body:string, status:int}>

License

MIT License

esp32quickjs's People

Contributors

bellard avatar binzume 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.