Skip to content

arduino/micropython.js

Repository files navigation

micropython.js

This is an partial port of pyboard.py to javascript.

Basic usage

const Board = require('micropython.js')
// Instantiate board class
const board = new Board()

// List available boards
const ports = await board.listPorts()
console.log('available boards', ports)

// Connect to a serial path
await board.open('/dev/ttyUSB0')

// Enter raw repl, execute command, get output and leave raw repl
await board.enter_raw_repl()
const output = await board.exec_raw({ command: "print(123)" })
await board.exit_raw_repl()

// List files on the board
const rootFiles = await board.fs_ils()
console.log('files at /', rootFiles)

// Close serial
await board.close()

Examples

  1. Navigate to example folder cd examples
  2. Execute files with PORT environment variable: PORT=/dev/tty.SLAB_USBtoUART node 05_list_files.js

Command Line Interface (CLI)

  1. Run CLI node cli.js [ARGUMENTS]...

Read more

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published