Fixed arduino compile errors, used sizeof() to determine the length of an array