I am creating a Pong Game using an 8x8 LED Matrix and the LedControl library to control it. I want to implement a feature which scrolls the current score across the screen when a point is scored, but cannot find a data type to convert the score to that the text scrolling function will accept. (I try to put the variable in the brackets that contain the message to be scrolled, and receive an error. Help would be greatly appreciated. The entire program was too long to include in text, so I have attached the file, as well as the line which the data to be displayed.
// Message to be scrolled goes in the { }
const unsigned char scoreText[] PROGMEM = {score1};
Is the error a secret? I do not feel like digging through 14K of code to try to figure out what the error might be.
Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags.
My bad. Since I usually can enter strings into that line to scroll text, I tried converting my score values (which were integers) to strings, but this did not work. The error was as follows:
Arduino: 1.8.13 (Mac OS X), Board: "Arduino Nano, ATmega328P (Old Bootloader)"
LedControl_scrolling:16:58: error: cannot convert 'String' to 'const unsigned char' in initialization
const unsigned char scoreText[] PROGMEM = {String(score1)};
^
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:28:0,
from sketch/LedControl_scrolling.ino.cpp:1:
/Users/nicholasmascioni/Documents/Arduino/LedControl_scrolling/LedControl_scrolling.ino: In function 'void loadBufferLong(int)':
LedControl_scrolling:55:50: error: 'font5x7' was not declared in this scope
unsigned long c = pgm_read_byte_near(font5x7 + ((ascii - 0x20) * 8) + a); // Index into character table to get row data
^
LedControl_scrolling:60:41: error: 'font5x7' was not declared in this scope
byte count = pgm_read_byte_near(font5x7 +((ascii - 0x20) * 8) + 7); // Index into character table for kerning data
^
exit status 1
cannot convert 'String' to 'const unsigned char' in initialization