Bunny Jump Code!

Nicole Gertseva
Nicole Gertseva
Last updated 
// NeoPixel test program showing use of the WHITE channel for RGBW
// pixels only (won't look correct on regular RGB NeoPixel strips).

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define LED_PIN   4 //DIN pin
#define CTRL_PIN  8 //Button pin
// How many NeoPixels are attached to the Arduino?
#define LINES     8 // number of rows in the LED matrix
#define COLUMNS   16 //number of columns in the LED matrix
#define LED_COUNT COLUMNS*LINES
// NeoPixel brightness, 0 (min) to 255 (max)
#define BRIGHTNESS 10 // Set BRIGHTNESS to about 1/5 (max = 255)
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#define GRASS_COLOR strip.Color(0,32,0)
#define SKY_COLOR strip.Color(0,0,32)
#define TEXT_COLOR strip.Color(128,0,0)

int phase;
int xPos;
int yPos;
int Tick;
int RfrshTicks;
int DisplaySpeed;
int StartPhase;
String oPhrase1;
String oPhrase2;
int crtPos[2][2]; //array of carrots position and state
int BunnyState;
int JumpPhase;
int RainbowPhase;
int CtrlPin_State;
int Prgrs;
uint32_t carrotBottom;
uint32_t carrotTop;
uint32_t carrotStumped;
uint32_t RnbClrs[6]; // array for rainbow colors

void setup()
{
  pinMode(CTRL_PIN, INPUT); //initializing pin botton conncted for input 
  randomSeed(analogRead(0)); //initializing random number generator
  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(BRIGHTNESS); //Setting brightness
  carrotBottom=strip.Color(255,147,8); //set color for bottom part of the carrot
  carrotTop=strip.Color(60,128,32); //set color for top part of the carrot
  carrotStumped=strip.Color(16,16,16); //set color for stumped carrot
  RnbClrs[0]=strip.Color(238,0,238); RnbClrs[1]=strip.Color(163,73,163); RnbClrs[2]=strip.Color(0,0,128); RnbClrs[3]=strip.Color(0,198,64); //setting array of colors for rainbow line
  RnbClrs[4]=strip.Color(196,196,96); RnbClrs[5]=strip.Color(196,96,0); RnbClrs[6]=strip.Color(196,0,0);
  RainbowPhase=-1; //no rainbow at the beginning
  phase=1; //start from setup phase
  xPos=14; //initializing X position for running text - not used
  yPos=2; //initializing Y position for running text - not used
  Tick=1; //counting cicles: we need read button's state more often than change bunny and carrot's positions
  StartPhase=0; //strat phase: 0 show speed, 1 allow to increase speed, 2 allow to decrease speed, 3 start game
  RfrshTicks=50; //how many ticks between refreshing bunny and carrots positions - variable may be changed during setup, smaller number - more often positions are changing
  DisplaySpeed=10; // number displaying on the screen to represent speed: smaller number -> bigger refresh ticks -> slower positions changing
  JumpPhase=0; // used to determine bunny positions during jump: 0 - sitting
  CtrlPin_State=0; // button not pushed at the beginning
  crtPos[0][0]=-5; crtPos[1][0]=-5; crtPos[0][1]=1; crtPos[1][1]=1; //carrot position outside of the screen and carrots were not stumped
  oPhrase1="V"; //first part of the setup message
  oPhrase2=""; // second part of the setup message
  BunnyState=1; // bunny in sitting position
  SetScene(GRASS_COLOR,SKY_COLOR); //set pixels for sky and ground
  displayText("V",0,2,TEXT_COLOR); //set pixels to display V at the left of the screen
  displayText(":"+String(DisplaySpeed),5,2,TEXT_COLOR); //set pixels to display speed number next to the V
  strip.show();            // show setup screen
}

void loop() //infinity loop to catch button's click and refresh screen
{
  if(phase==1 && (((Tick % 100)==0) || (StartPhase==-1))) //refresh setup screen every 100 ticks
  {
    if(StartPhase==-1){StartPhase=3;} //set StartPhase to display speed value
    switch(StartPhase) //changing StartPhase every 100 ticks
    {
      case 0: //changing SatrtPhase to 1 - allow to increase speed
        oPhrase1="V"; oPhrase2=":>";
        StartPhase=1;
        break;
      case 1: //changing SatrtPhase to 2 - allow to deccrease speed
        oPhrase1="V"; oPhrase2=":<";
        StartPhase=2;
        break;
      case 2: //changing SatrtPhase to 3 - allow to start game
        oPhrase1=" GO"; oPhrase2="";
        StartPhase=3;
        break;
      case 3: //changing SatrtPhase to 0 - display speed value
        oPhrase1="V"; oPhrase2=":"+String(DisplaySpeed);
        StartPhase=0;
        crtPos[0][0]=-5; crtPos[1][0]=-5; crtPos[0][1]=1; crtPos[1][1]=1;
       break;
    }
  }
  delay(10); //delay for 10 milliseconds
  if((Tick % RfrshTicks)==0) //prepare screen for refresh
  {
    switch(phase) //determine  is it setup or game
    {
      case 1: //setup process: decrease carrot's position by 1 and check if position out of the screen reset it to the beginning of the screen
        crtPos[0][0]--;
        if(crtPos[0][0]<2){crtPos[0][0]=18;}
        carrot(crtPos[0][0],1);
        break;
      case 2: //game
        crtPos[0][0]--; crtPos[1][0]--; // decrease both carrot's positions
        if(crtPos[0][0]<2){if(crtPos[1][0]<3){if(random(100)<50){crtPos[0][0]=18;crtPos[0][1]=1;}};if(crtPos[1][1]==1){Prgrs++;}else{Prgrs--;RainbowPhase=-1;}}; 
        //if first carrot close to the beginning of the screen randomly move second carrot to the end of the screen
        if(crtPos[1][0]<2){if(crtPos[0][0]<3){if(random(100)<50){crtPos[1][0]=18;crtPos[1][1]=1;}};if(crtPos[0][1]==1){Prgrs++;}else{Prgrs--;RainbowPhase=-1;}};
        //if second carrot close to the beginning of the screen randomly move first carrot to the end of the screen

        if(crtPos[0][0]==-1){if(crtPos[0][1]==1){Prgrs++;RainbowPhase=0;}else{Prgrs--;RainbowPhase=-1;}}; 
        //if first carrot out of the screen and not stumped set rainbow phase to 0
        if(crtPos[1][0]==-1){if(crtPos[1][1]==1){Prgrs++;RainbowPhase=0;}else{Prgrs--;RainbowPhase=-1;}};
        //same for second carrot
        break;
    }
  }
  if((CtrlPin_State==LOW)&&(digitalRead(CTRL_PIN)==HIGH)) //checking if button was pressed during tick
  {
    switch(phase)
    {
      case 1: //setup phase
        switch(StartPhase)
        {
          case 0:
            break; //speed displayed, do nothing
          case 1: //speed increasing - increase display number by one and decrese number of ticks between refresh by 20%
            if(RfrshTicks>0){DisplaySpeed+=1;RfrshTicks-=RfrshTicks/5;}
            StartPhase=3;
            break;
          case 2: //speed decreasing - decrease display number by one and increse number of ticks between refresh by 20%
            if(DisplaySpeed>1){DisplaySpeed-=1;RfrshTicks=1.2*RfrshTicks;}
            StartPhase=3;
            break;
          case 3: //switch to game phase
            oPhrase1=""; oPhrase2=""; Prgrs=0;
            phase=2;
            break;
        }
        break;
      case 2: //Bunny in sitting position and not jumping yet - start jump
        if(BunnyState==2 && JumpPhase==0){JumpPhase=1;}
        break;
    }
    CtrlPin_State=HIGH; //switch button's state to pushed
  }else
  {
    CtrlPin_State=digitalRead(CTRL_PIN); //switch button's state
  }
  if(((Tick % RfrshTicks)==0) || (phase==1 && ((Tick % 100)==0))) //checking if refresh display needed
  {
    SetScene(GRASS_COLOR,SKY_COLOR); //sky and grass
    if(phase==1) //setup
    {
      if(oPhrase1!=""){displayText(oPhrase1,0,2,TEXT_COLOR);}; //if phrase 1 not empty display it
      if(oPhrase2!=""){displayText(oPhrase2,5,2,TEXT_COLOR);}; //if phrase 2 not empty display it
      carrot(crtPos[0][0],1); //display carrot 1 at the position
    }else
    {
      carrot(crtPos[0][0],crtPos[0][1]);carrot(crtPos[1][0],crtPos[1][1]); //display carrots
      ShowRainbow(); //display rainbow if needed
      displayBunny(BunnyState); //display bunny
    }
    if(Prgrs>0) //reserved to indicate progress
    {

    }
    strip.show(); //load display's data to the screen
  }  
  Tick++; //increasing tick
  if(Tick==(100*RfrshTicks)){Tick=0;} //reset tick to 0 to avoid overflow
}
//function to set pixel at particular position to specific color
void setPixelColor(int x,int y,uint32_t color)
{
  if((x % 2)==0) //even columns - pixel's position increases from top to down
  {
    strip.setPixelColor(LED_COUNT-1-x*LINES-y,color);
  }else //odd columns - pixel's position decreases from top to down
  {
    strip.setPixelColor(LED_COUNT-(x+1)*LINES+y,color);
  }
}
//display rainbow on the top of the screen
void ShowRainbow() 
{
  int cC;
  if(RainbowPhase>-1) //if rainbow phase > -1
  {
    for(int x=0; x<COLUMNS; x++) //working with each pixel in the top row
    {
      setPixelColor(x,LINES-1,RnbClrs[(RainbowPhase+x)%6]); //color selected from rainbow colors array
    }
    RainbowPhase+=1; //increase rainbow phase
    if(RainbowPhase>6){RainbowPhase=-1;} //turn off rainbow if phase more than 6
  }
}
//display sky and land
void SetScene(uint32_t clrGrnd, uint32_t clrSky)
{
  for(int x=0; x<COLUMNS; x++) //all columns
  {
    for(int y=0; y<LINES; y++) //all rows
    {
      if(y==0)
      {
        setPixelColor(x,y,clrGrnd); //for lowest row set color to ground
      }else
      {
        setPixelColor(x,y,clrSky); // for all other rows to sky
      }
    }
  }
}
//display carrot in position x, state norm
void carrot(int x, int norm)
{
  if((x>-2)&&(x<18))
  {
    if(norm==1) //normal carrot
    {
      setPixelColor(x,0,carrotBottom); setPixelColor(x+1,0,carrotBottom);
      setPixelColor(x,1,carrotTop); setPixelColor(x+1,1,carrotTop);
    }else
    { //stumped carrot
      setPixelColor(x,0,carrotStumped); setPixelColor(x+1,0,carrotStumped);
      setPixelColor(x,1,carrotStumped); setPixelColor(x+1,1,carrotStumped);
    }
  }
}
//display bunny
void displayBunny(int Bstate)
{
  uint32_t color = strip.Color( 32, 32,  32); //bunny color
  int x = 2; //horizontal position
  int y = 1; //vertical position
  int arrP[7][5] = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}; //2 dimentional array for bunny
  switch(Bstate)
  {
    case 1: //sitting
      arrP[1][0]=1; arrP[1][1]=1; arrP[2][0]=1; arrP[2][1]=1; arrP[3][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[4][1]=1;
      BunnyState=2;
      break;
    default: // jumping
      arrP[0][0]=1; arrP[1][1]=1; arrP[2][1]=1; arrP[2][2]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][4]=1; arrP[4][1]=1; arrP[4][2]=1; arrP[4][3]=1; arrP[5][0]=1; arrP[5][2]=1;
      switch(JumpPhase)
      {
        case 0: // not in jump, back to sitting
          BunnyState=1;
          break;
        case 1: //increase jump phase
          JumpPhase++; 
          break;
        case 2: //one row higher
        case 3:
        case 8:
        case 9:
          JumpPhase++; y=2;
          break;
        case 4: //two rows higher
        case 5:
        case 6:
        case 7:
          JumpPhase++; y=3;
          break;
        case 10: //return to sitting
          BunnyState=1; JumpPhase=0;
          break;
      }
      break;
  }
  //calculating stamping on the carrot
  int ic;
  ic=-1; //funding carrot under bunny
  if(crtPos[0][0]<9 && crtPos[0][0]>1){ic=0;}
  if(crtPos[1][0]<9 && crtPos[1][0]>1){ic=1;}
  if(ic>-1 && y==1 && crtPos[ic][1]==1) //checking if any displayed pixel of bunny is on the carrot's position
  {
    for(int i=1;i<6;i++)
    {
      if(arrP[i][0]==1 && ((x+i)==crtPos[ic][0] || (x+i)==crtPos[ic][0]+1)) //STUMPED!!!
      {
        crtPos[ic][1]=0; RainbowPhase=-1; //set carrot's state to stumped and stop rainbow
        carrot(crtPos[ic][0],crtPos[ic][1]); break;
      }
    }
  }
  for(int i=0;i<7;i++) //set actual pixel on the screen to bunny color
  {
    for(int j=0;j<5;j++)
    {
      if(arrP[i][j]>0 && (x+i)>-1 && (x+i)<COLUMNS && (y+j)>-1 && (y+j)<LINES)
      {
        setPixelColor(x+i,y+j,color);
      }
    }
  }
}
//display symbol at particular position
int displaySymbol(char Symb, int x,int y,uint32_t color)
{
  int cLen=4;
  int arrP[5][5] = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}};
  switch(Symb)
  {
   case ' ':
    cLen=3;
    break;
   case 'A':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][1]=1; arrP[2][4]=1; arrP[2][1]=1; arrP[3][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1;
    break;
   case 'B':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][2]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][3]=1;
    break;
   case 'C':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][0]=1; arrP[3][0]=1 ;arrP[3][4]=1;
    break;
   case 'D':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1;
    break;
   case 'E':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][2]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][0]=1; arrP[3][4]=1; arrP[3][0]=1;
    break;
   case 'F':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][2]=1; arrP[2][4]=1; arrP[2][2]=1;; arrP[3][4]=1;
    break;
   case 'G':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][0]=1; arrP[3][4]=1; arrP[3][1]=1; arrP[3][2]=1;
    break;
   case 'H':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][2]=1; arrP[2][2]=1; arrP[3][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[3][4]=1;
    break;
   case 'I':
    cLen=3;
    arrP[0][0]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[1][1]=1; arrP[1][2]=1; arrP[1][3]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][4]=1;
    break;
   case 'J':
    arrP[0][1]=1; arrP[1][0]=1; arrP[1][4]=1; arrP[2][1]=1; arrP[2][2]=1; arrP[2][3]=1; arrP[2][4]=1; arrP[3][4]=1;
    break;
   case 'K':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][2]=1; arrP[2][1]=1; arrP[2][3]=1; arrP[3][0]=1; arrP[3][4]=1;
    break;
   case 'L':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[2][0]=1; arrP[3][0]=1; arrP[3][0]=1;
    break;
   case 'M':
    cLen=5;
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][3]=1; arrP[2][2]=1; arrP[3][3]=1; arrP[4][0]=1;  arrP[4][1]=1; arrP[4][2]=1; arrP[4][3]=1; arrP[4][4]=1;
    break;
   case 'N':
    cLen=5;
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][3]=1; arrP[2][2]=1; arrP[3][1]=1; arrP[4][0]=1; arrP[4][1]=1; arrP[4][2]=1; arrP[4][3]=1; arrP[4][4]=1;
    break;
   case 'O':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1;
    break;
   case 'P':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][2]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[3][3]=1;
    break;
   case 'Q':
    cLen=5;
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[4][0]=1;
    break;
   case 'R':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][4]=1; arrP[1][2]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][1]=1; arrP[3][3]=1; arrP[3][0]=1;
    break;
   case 'S':
    arrP[0][0]=1; arrP[0][3]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1; arrP[3][4]=1;
    break;
   case 'T':
    cLen=5;
    arrP[0][4]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][1]=1; arrP[2][2]=1; arrP[2][3]=1; arrP[2][4]=1; arrP[3][4]=1; arrP[4][4]=1;
    break;
   case 'U':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[3][4]=1;
    break;
   case 'V':
    cLen=5;
    arrP[0][4]=1; arrP[0][3]=1; arrP[1][2]=1; arrP[1][1]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[4][3]=1; arrP[4][4]=1;
    break;
   case 'W':
    cLen=5;
    arrP[0][4]=1; arrP[0][3]=1; arrP[0][2]=1; arrP[0][1]=1; arrP[1][0]=1; arrP[2][1]=1; arrP[2][2]=1; arrP[3][0]=1; arrP[4][1]=1; arrP[4][2]=1; arrP[4][3]=1; arrP[4][4]=1;
    break;
   case '0':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][4]=1; arrP[1][3]=1; arrP[1][0]=1; arrP[2][4]=1; arrP[2][2]=1; arrP[2][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1;
    break;
   case '1':
    cLen=3;
    arrP[0][0]=1; arrP[0][3]=1; arrP[1][0]=1; arrP[1][1]=1; arrP[1][2]=1; arrP[1][3]=1; arrP[1][4]=1; arrP[2][0]=1;
    break;
   case '2':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][0]=1; arrP[3][3]=1;
    break;
   case '3':
    arrP[0][0]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1; arrP[3][3]=1;
    break;
   case '4':
    arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][1]=1; arrP[2][1]=1; arrP[3][0]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[3][4]=1;
    break;
   case '5':
    arrP[0][0]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1; arrP[3][4]=1;
    break;
   case '6':
    arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1;
    break;
   case '7':
    arrP[0][0]=1; arrP[0][4]=1; arrP[1][1]=1; arrP[1][4]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][3]=1; arrP[3][4]=1;
    break;
   case '8':
    arrP[0][1]=1; arrP[0][3]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1; arrP[3][3]=1;
    break;
   case '9':
    arrP[0][3]=1; arrP[1][0]=1; arrP[1][2]=1; arrP[1][4]=1; arrP[2][0]=1; arrP[2][2]=1; arrP[2][4]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[3][3]=1;
    break;
   case '=':
    cLen=3;
    arrP[0][1]=1; arrP[0][3]=1; arrP[1][1]=1; arrP[1][3]=1; arrP[2][1]=1; arrP[2][3]=1;
    break;
   case ':':
    cLen=1;
    arrP[0][1]=1; arrP[0][3]=1;
    break;
   case '>':
    cLen=5;
    arrP[0][2]=1; arrP[1][2]=1; arrP[1][3]=1; arrP[2][2]=1; arrP[2][3]=1; arrP[2][4]=1; arrP[3][2]=1; arrP[3][3]=1; arrP[3][2]=1; arrP[4][2]=1;
    break;
   case '<':
    cLen=5;
    arrP[0][2]=1; arrP[1][2]=1; arrP[1][1]=1; arrP[2][2]=1; arrP[2][1]=1; arrP[2][0]=1; arrP[3][2]=1; arrP[3][1]=1; arrP[3][2]=1; arrP[4][2]=1;
    break;
   case '~':
    arrP[0][0]=1; arrP[0][1]=1; arrP[0][2]=1; arrP[0][3]=1; arrP[0][4]=1; arrP[1][1]=1; arrP[1][2]=1; arrP[1][3]=1; arrP[2][2]=1;
    break;
   default:
    for(int i=0;i<5;i++){for(int j=0;j<5;j++){arrP[i][j]=1;}};
    color=strip.Color(32,32,32);
    break;
  }
  for(int i=0;i<cLen;i++)
  {
    for(int j=0;j<5;j++)
    {
      if(arrP[i][j]>0 && (x+i)>-1 && (x+i)<COLUMNS && (y+j)>-1 && (y+j)<LINES)
      {
        setPixelColor(x+i,y+j,color);
      }
    }
  }
  return cLen;
}
//display string at particular position
int displayText(String Val, int x,int y,uint32_t color)
{
  int cP=x;
  int sL = Val.length();
  for(int i=0;i<sL;i++)
  {
    cP+=displaySymbol(Val[i],cP,y,color)+1;
  }
}