Creates an lcd-rgb device.
text-lcd-rgb-device
@/text-lcd-rgb-device
Creates an lcd-rgb device.
To use the node in your project you should have the
rcb71/seeed-lcd-16x2
library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See
Using libraries for more info.
#pragma XOD error_raise enable
#pragma XOD require "https://github.com/Seeed-Studio/Grove_LCD_RGB_Backlight/"
#include <Wire.h>
#include <rgb_lcd.h>
#include <string.h>
node {
meta {
struct Type {
rgb_lcd* lcd;
uint8_t rows;
uint8_t cols;
};
}
uint8_t mem[sizeof(rgb_lcd)];
void evaluate(Context ctx) {
auto wire = getValue<input_I2C>(ctx);
uint8_t rows = (uint8_t) getValue<input_ROWS>(ctx);
uint8_t cols = (uint8_t) getValue<input_COLS>(ctx);
Type t;
t.rows = rows;
t.cols = cols;
t.lcd = new (mem) rgb_lcd();
t.lcd->begin(t.cols, t.rows, LCD_5x8DOTS, *wire);
//t.lcd->begin();
emitValue<output_DEV>(ctx, t);
emitValue<output_DONE>(ctx, 1);
}
}