what is going wrong??? the idea is to center the number you put

if you want to put to your panel you need to have DFRobt panel library or something like this.
This is the code.

#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;

int x = 0;
int y = 0;

void setup() {
Serial.begin(9600);
showNumbers(121);
}

void loop() {

}

void showNumbers(unsigned int value) {

int x = 0;
int y = 0;

// definim culoarea implicita
int color = WHITE;
if ( value > 700 ) { color = YELLOW; }
if ( value > 1000 ) { color = RED; }

panel.clear();

String numToText = String(value);
unsigned int sOn = 0;
unsigned int numToTextLength = numToText.length();

for (int i=0; i<numToTextLength; i++) {

switch (numToText*) {*

  • case ‘1’:*

  • sOn += 4;*

  • break;*

  • case ‘2’:*

  • sOn += 4;*

  • break;*

  • case ‘3’:*

  • sOn += 4;*

  • break;*

  • case ‘4’:*

  • sOn += 4;*

  • break;*

  • case ‘5’:*

  • sOn += 4;*

  • break;*

  • case ‘6’:*

  • sOn += 4;*

  • break; *

  • case ‘7’:*

  • sOn += 4;*

  • break;*

  • case ‘8’:*

  • sOn += 4;*

  • break;*

  • case ‘9’:*

  • sOn += 4;*

  • break;*

  • case ‘0’:*

  • sOn += 4;*

  • break;*

  • }*

  • }*
    sOn = sOn - 1;
    x = (16 - sOn) / 2;

  • for (int i=0; i<numToTextLength; i++) {*

_ switch (numToText*) {_
_
case ‘1’:_
_
panel.pixel(x, y, color);_
_
panel.pixel(x, y+1, color);_
_
panel.pixel(x, y+2, color);_
_
panel.pixel(x, y+3, color);_
_
panel.pixel(x, y+4, color);_
_
x = x + 2;_
_
break;*_

* case ‘2’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x, y+3, color);*
* panel.pixel(x, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x+2, y+4, color);*
* x = x + 4;*
* break;*

* case ‘3’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x, y+4, color);*
* x = x + 4;*
* break;*

* case ‘4’:*
* panel.pixel(x, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+4, color);*
* x = x + 4;*
* break;*

* case ‘5’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x, y+4, color);*
* x = x + 4;*
* break;*

* case ‘6’:*
* panel.pixel(x, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x, y+3, color);*
* panel.pixel(x, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x+2, y+4, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x, y+2, color);*
* x = x + 4;*
* break; *

* case ‘7’:*
* if (numToText[i-1] == ‘6’) {*
* x = x - 1;*
* } *
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+4, color);*
* x = x + 4; *
* break;*

* case ‘8’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x, y+3, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x+2, y+4, color); *
* x = x + 4;*
* break;*

* case ‘9’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x+1, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x+2, y+4, color); *
* x = x + 4;*
* break;*

* case ‘0’:*
* panel.pixel(x, y, color);*
* panel.pixel(x+1, y, color);*
* panel.pixel(x+2, y, color);*
* panel.pixel(x, y+1, color);*
* panel.pixel(x+2, y+1, color);*
* panel.pixel(x, y+2, color);*
* panel.pixel(x+2, y+2, color);*
* panel.pixel(x, y+3, color);*
* panel.pixel(x+2, y+3, color);*
* panel.pixel(x, y+4, color);*
* panel.pixel(x+1, y+4, color);*
* panel.pixel(x+2, y+4, color); *
* x = x + 4;*
* break;*

* }*
* }*
* }*

  1. Use code tags (the </> button) when posting code - the forum parses pieces of the code as markup and mangles the code.
[i]

gets turned into the start of a block of italic text, and an 8 followed by a ) turns into a smiley face with sunglasses, and so on.

  1. Describe the behavior produced by this sketch and how it differs from your expectations. Few of us will have the hardware needed to test it, and even if we do, most of us answer questions from our phones, so even if we wanted to wire up hardware and upload the code to help you for free, we can’t do it when we’re on the forums (when we’re home in our workshops, we’ve got our own projects to work on). Does it compile but not do what you expect? Do you get an error? If so post the full text of any and all error messages (you should always do this whenever asking for help with a problem in which an error message is shown).

  2. Tell us what board you are using. If it is not an official board, link to the third party hardware package (sometimes called a “core”) you’re using to add support to it (it’s not sufficient to name the package, as people stop maintaining their package, another person comes along and starts maintaining it, but since the first person isn’t around anymore but still controls the website/repo where it used to be hosted, the old version stays around - not to mention people forking github repos and tweaking them). Actually, the same goes for libraries; there are, for example, at least 4 mutually incompatible versions of the “LiquidCrystal_I2C” library that were meant for public consumption, and at least that many versions of “ATTinyCore” as well - and hundreds of forks that are on public github repos but not meant for general use, most of which have no documentation describing how they differ from the versions they were forked from.