Sub Process_Globals
Public Serial1 As Serial
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
Log("RAM: ", AvailableRAM)
For i = 0 To 20
Log(GetByte(i))
Next
End Sub
Private Sub GetByte(Index As UInt) As Byte
Return RunNative("getdata", Index)
End Sub
#if C
#include <avr/pgmspace.h>
const PROGMEM byte data[] = { //change the data here
1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE
};
B4R::Object beo1;
B4R::Object* getdata(B4R::Object* o) {
return beo1.wrapNumber(pgm_read_byte_near(data + o->toLong()));
}
#end if