wayland/text-lcd-i2c
#pragma XOD error_raise enable #pragma XOD require "https://github.com/WaylandM/Arduino-LiquidCrystal-I2C-library-MTW" #include <Wire.h> #include <LiquidCrystal_I2C_MTW.h> node { meta { struct Type { LiquidCrystal_I2C_MTW* lcd; uint8_t rows; uint8_t cols; }; } uint8_t mem[sizeof(LiquidCrystal_I2C_MTW)]; void evaluate(Context ctx) { auto wire = getValue<input_I2C>(ctx); uint8_t addr = getValue<input_ADDR>(ctx); uint8_t rows = (uint8_t) getValue<input_ROWS>(ctx); uint8_t cols = (uint8_t) getValue<input_COLS>(ctx); if (addr > 127) { raiseError(ctx); return; } Type t; t.rows = rows; t.cols = cols; t.lcd = new (mem) LiquidCrystal_I2C_MTW(*wire, addr, cols, rows); //t.lcd->begin(); emitValue<output_DEV>(ctx, t); } }
© 2017–2024XOD Inc
Contact us: hello@xod.io