Sub Process_Globals Public Serial1 As Serial
Private lcd As LiquidCrystal_I2C
Private CharDegree = 0, CharQuotes = 1 As Byte
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
lcd.Initialize(0x27, 20, 4)
lcd.Backlight = True
'Special Chars
RunNative("createChar", Null)
lcd.SetCursor(0,0)
RunNative("writeChar", CharQuotes)
lcd.Write("25")
RunNative("writeChar", CharDegree)
RunNative("writeChar", CharQuotes)
End Sub
#if C
Byte degree[8] = {
B00111,
B00101,
B00111,
B00000,
B00000,
B00000,
B00000,
B00000
};
Byte quotes[8] = {
B00101,
B00101,
B00101,
B00000,
B00000,
B00000,
B00000,
B00000
};
//Create the special chars:0=degee,1=quotes
//Use:
//RunNative("createChar", Null)
void createChar(B4R::Object* o) {
b4r_main::_lcd->lcd->createChar(0, degree);
b4r_main::_lcd->lcd->createChar(1, quotes);
}
//Write a special chart to the display: 0=degree,1=quotes
//Use:
//lcd.SetCursor(0,1)
//RunNative("writeChar", 0)
void writeChar(B4R::Object* o) {
b4r_main::_lcd->lcd->write((Byte)o->toULong());
}
#end if