| Crates.io | grove-lcd-rgb |
| lib.rs | grove-lcd-rgb |
| version | 0.1.1 |
| created_at | 2025-12-12 00:35:00.439094+00 |
| updated_at | 2025-12-12 02:58:52.890331+00 |
| description | Platform-agnostic driver for Grove LCD RGB Backlight using embedded-hal, with full support for v4 and v5 hardware |
| homepage | |
| repository | https://github.com/maththedude/grove-lcd-rgb |
| max_upload_size | |
| id | 1980796 |
| size | 92,493 |
A platform-agnostic Rust driver for the Grove LCD RGB Backlight display using embedded-hal traits. Provides full control over the 16x2 character LCD with RGB backlight via I2C.
embedded-hal 1.0no_std compatibleThe Grove LCD RGB Backlight uses two I2C devices:
The driver automatically detects which version you have and uses the appropriate configuration.
Add this to your Cargo.toml:
[dependencies]
grove-lcd-rgb = { git = "https://github.com/maththedude/grove-lcd-rgb" }
embedded-hal = "1.0"
Or from crates.io (once published):
[dependencies]
grove-lcd-rgb = "0.1"
use grove_lcd_rgb::GroveLcd;
// Create LCD instance with your I2C peripheral and delay provider
let mut lcd = GroveLcd::new(i2c, delay);
// Initialize LCD (16 columns, 2 rows)
lcd.begin(16, 2)?;
// Set backlight color to green
lcd.set_rgb(0, 255, 0)?;
// Display text
lcd.print("Hello, World!")?;
// Set cursor to second line
lcd.set_cursor(0, 1)?;
lcd.print("Grove LCD")?;
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_hal::{delay::Delay, i2c::master::{Config, I2c}};
use grove_lcd_rgb::GroveLcd;
esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 65536);
#[esp_hal::main]
fn main() -> ! {
let peripherals = esp_hal::init(esp_hal::Config::default());
let i2c = I2c::new(peripherals.I2C0, Config::default())
.unwrap()
.with_sda(peripherals.GPIO6)
.with_scl(peripherals.GPIO7);
let delay = Delay::new();
let mut lcd = GroveLcd::new(i2c, delay);
lcd.begin(16, 2).unwrap();
lcd.set_rgb(0, 255, 0).unwrap();
lcd.print("Hello, ESP32!").unwrap();
loop {}
}
The crate includes several examples for ESP32-C6. To run them:
# Basic "Hello World" example
cargo run --example esp32c6_basic --release
# I2C device scanner
cargo run --example esp32c6_i2c_scan --release
# Color cycling demo
cargo run --example esp32c6_color_test --release
# Counter with color changes
cargo run --example esp32c6_counter --release
# Full thermostat example
cargo run --example esp32c6_thermostat --release
# Advanced diagnostic tool
cargo run --example esp32c6_diagnostic --release
lcd.begin(cols: u8, rows: u8) -> Result<(), LcdError<E>>
lcd.clear() // Clear display
lcd.home() // Return cursor to (0,0)
lcd.set_cursor(col: u8, row: u8) // Position cursor
lcd.display() // Turn display on
lcd.no_display() // Turn display off
lcd.set_rgb(r: u8, g: u8, b: u8) // Set RGB color
lcd.backlight_white() // Set to white
lcd.backlight_off() // Turn off backlight
lcd.print(s: &str) // Print string
lcd.write(value: u8) // Write single byte
lcd.cursor() // Show cursor
lcd.no_cursor() // Hide cursor
lcd.blink() // Blink cursor
lcd.no_blink() // Stop blinking
lcd.scroll_display_left() // Scroll content left
lcd.scroll_display_right() // Scroll content right
lcd.create_char(location, charmap) // Create custom character
lcd.left_to_right() // Text flows left to right
lcd.right_to_left() // Text flows right to left
| Feature | v4.0 | v5.0 |
|---|---|---|
| RGB Chip | PCA9632 | SGM31323 |
| RGB I2C Address | 0x62 | 0x30 |
| RGB Registers | R:0x04, G:0x03, B:0x02 | R:0x06, G:0x07, B:0x08 |
| Voltage | 5V only | 3.3V/5V compatible |
The driver automatically detects and handles both versions!
Grove LCD ESP32-C6
--------- --------
GND GND
VCC 5V (or 3.3V for v5)
SDA GPIO6 (configurable)
SCL GPIO7 (configurable)
The driver should auto-detect v5 hardware. If colors don't work:
Add to your Cargo.toml:
[dependencies]
grove-lcd-rgb = { git = "https://github.com/maththedude/grove-lcd-rgb" }
# Or after publishing:
# grove-lcd-rgb = "0.1"
Then in your code:
use grove_lcd_rgb::GroveLcd;
let mut lcd = GroveLcd::new(i2c, delay);
lcd.begin(16, 2)?;
lcd.print("Working!")?;
Licensed under either of:
at your option.
Based on the Seeed Studio Grove LCD RGB Backlight Arduino library.
Publicly avalible large-language models were used in the production of this library. The rights of the models' trainers to use the training data they did cannot be verified. If this violates the laws, organizational standards, or moral standards that bind you, please refrain from using any of this code.