OpenBlink is an open source project forked from ViXion Blink.
- Ruby, a highly productive lightweight language, can be used to develop embedded devices.
- Program rewriting and debugging console are completely wireless. (BluetoothLE)
- Rewriting time is less than 0.1 second and does not involve a microprocessor restart. (We call it "Blink".)
To clone the repository and initialize the submodules, run the following commands:
$ git clone https://github.com/OpenBlink/openblink-demo-m5.git
$ pio run
$ pio run -e m5stack-stamps3 -t erase -t uploadNote: Both
m5stack-stamps3andm5stack-atomenvironments are configured in platformio.ini and can be used for device operations. The examples above usem5stack-stamps3, but you can usem5stack-atomby replacingm5stack-stamps3withm5stack-atomin the commands.
The following hardware platforms have been tested with OpenBlink:
- M5 StampS3 (Espressif ESP32-S3FN8)
- M5 ATOM (Espressif ESP32)
For more detailed documentation, please check the doc directory For AI-powered comprehensive documentation that helps you understand the codebase, visit DeepWiki.
OpenBlink provides a simple API for controlling the onboard RGB LED through mruby/c.
LED.set([r, g, b])- Sets the RGB LED color. Each value should be between 0-255.
Blink.req_reload?- Checks if a code reload is requested.
Here's a simple example that makes the LED blink in different colors:
# RGB LED Blinking Example
while true do
# Red
LED.set([255, 0, 0])
sleep 1
# Green
LED.set([0, 255, 0])
sleep 1
# Blue
LED.set([0, 0, 255])
sleep 1
# Check if reload is requested
break if Blink.req_reload?
endThis example demonstrates:
- Setting RGB LED colors using the
LED.setmethod - Using arrays to specify RGB values
- Implementing a clean exit when code reload is requested
This is just an additional code on the previous LED Blinking Code.
RED = [255, 0, 0]
GREEN = [0, 255, 0]
BLUE = [0, 0, 255]
while true do
# Red
Display.set_text_color(63488);
Display.puts " RED"
puts "RED"
LED.set([255, 0, 0])
sleep 1
# Green
Display.set_text_color(2016);
Display.puts " GREEN"
puts "GREEN"
LED.set([0, 255, 0])
sleep 1
# Blue
Display.set_text_color(31);
Display.puts " BLUE"
puts "BLUE"
LED.set([0, 0, 255])
sleep 1
# Check if reload is requested
break if Blink.req_reload?
end
- The
break if Blink.req_reload?statement is crucial in OpenBlink applications. It allows the program to gracefully exit the current execution loop when a code reload is requested through the Bluetooth interface. Without this check, the program would continue running and ignore reload requests, making development and debugging difficult. This mechanism is what enables the "Blink" feature - the ability to update code wirelessly in less than 0.1 seconds without restarting the microprocessor.