Just starting to code, and code returns java.lang.reflect.InvocationTargetException error

Move these lines inside setup():

int[] score = int(loadBytes("score.dat"));
int[] best = int(loadBytes("best.dat"));
byte[] scoreByte = {byte(score[0])};
byte[] bestByte = {byte(best[0])};

Why? loadBytes() is defined as a both a member method and a static method. Your code references the member method which cannot be called outside setup() because sketchPath has not yet been set.

3 Likes