Set up your environment
Currently, BlueScript strictly requires macOS. Windows and Linux support is under development.
In this guide, we will install the BlueScript CLI and flash the runtime environment to your microcontroller.
Currently, only ESP32 development boards are supported.
Prerequisites
Before we begin, ensure you have the following:
- Hardware:
- Host PC: A laptop running macOS (Windows and Linux are currently not supported).
- Micocontroller: An ESP32 development board (e.g., ESP32-DevKitC)
- USB cable to connect your host PC and the microcontroller
- Software:
- Node.js (v20 or later) installed on your host PC.
Step 1: Install the CLI
BlueScript provides a command-line interface (CLI) to manage projects and communicate with your device. Install it globally using npm:
npm install -g @bscript/cli
Verify the installation:
bscript --version
Step 2: Board Setup
Because BlueScript uses a Disaggregated VM architecture, you need to install the lightweight Runtime onto your microcontroller.
The USB cable is only required for this step (flash-runtime). Once this is done, you can disconnect the cable and use Bluetooth for daily development.
1. Download Platform Tools
Download the necessary environment files for the ESP32 platform:
bscript board setup esp32
Note: Currently, only esp32 is supported.
2. Flash the Runtime
Connect your ESP32 to your computer via USB and flash the runtime:
bscript board flash-runtime esp32
The CLI will display a list of detected serial ports. Use the arrow keys to select the one corresponding to your ESP32 (e.g., /dev/tty.usbserial-xxxx).
If your device does not appear in the list, you may need to install USB-to-UART drivers (e.g., CP210x or FTDI).
See also Establish Serial Connection with ESP32.
If the flash is successful, your device is now ready to receive BlueScript code wirelessly!