To use the node in your project you should have the yzheka-m/nokia-5510-text-output 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.
C++ implementation
#pragma XOD require "https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library"
#pragma XOD require "https://github.com/adafruit/Adafruit-GFX-Library"
{{#global}}
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
{{/global}}
struct State {
Adafruit_PCD8544* display;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
State* state = getState(ctx);
if (isSettingUp()){
auto clk = getValue<input_CLK>(ctx);
auto din = getValue<input_DIN>(ctx);
auto dc = getValue<input_DC>(ctx);
auto cs = getValue<input_CS>(ctx);
auto rst = getValue<input_RST>(ctx);
state->display = new Adafruit_PCD8544(clk,din,dc,cs,rst);
state->display->begin();
}
state->display->clearDisplay();
state->display->setContrast(getValue<input_CONTRAST>(ctx));
state->display->setTextSize(getValue<input_TEXT_SIZE>(ctx));
auto text=getValue<input_TEXT>(ctx);
char txt[length(text) + 1] = { 0 };
dump(text, txt);
state->display->print(txt);
state->display->display();
}