Skip to content

nyasu3w/openblink-demo-m5

 
 

Repository files navigation

OpenBlink Demo M5

English 中文 日本語 Ask DeepWiki

What is OpenBlink

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".)

How to Get OpenBlink

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 upload

Note: Both m5stack-stamps3 and m5stack-atom environments are configured in platformio.ini and can be used for device operations. The examples above use m5stack-stamps3, but you can use m5stack-atom by replacing m5stack-stamps3 with m5stack-atom in the commands.

Verified Hardware

The following hardware platforms have been tested with OpenBlink:

  • M5 StampS3 (Espressif ESP32-S3FN8)
  • M5 ATOM (Espressif ESP32)

Documentation

For more detailed documentation, please check the doc directory For AI-powered comprehensive documentation that helps you understand the codebase, visit DeepWiki.

mruby/c LED Control API

OpenBlink provides a simple API for controlling the onboard RGB LED through mruby/c.

Available Classes and Methods

LED Class

  • LED.set([r, g, b]) - Sets the RGB LED color. Each value should be between 0-255.

Blink Class

  • Blink.req_reload? - Checks if a code reload is requested.

Example: LED Blinking Code

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?
end

This example demonstrates:

  • Setting RGB LED colors using the LED.set method
  • Using arrays to specify RGB values
  • Implementing a clean exit when code reload is requested

Example2: LCD output code

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.

About

A new way to develop embedded systems.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 63.0%
  • C++ 34.7%
  • Ruby 2.0%
  • CMake 0.3%