Odds Board - Custom Numbers

Build Part 4A

In this video, I will go over the basic hookup and design of the odds board.

Display Hookup

16x2 LCD Arduino
Pin 1 Ground
Pin 2 +3.3v
Pin 3 Ground
Pin 4 Data Pin
Pin 5 Ground
Pin 6 Data Pin
Pin 7
Pin 8
Pin 9
Pin 10
Pin 11 Data Pin
Pin 12 Data Pin
Pin 13 Data Pin
Pin 14 Data Pin
Pin 15 Data Pin
Pin 16 Ground


Build Part 4B

In this video, we will make all five displays show a number.



Build Part 4C

In this video, we will make all five odds boards display a random number between 1-200

Horse 1-5 Arduino Code

// left 5 boards

// include the library
#include 

LiquidCrystal horse23(23, 22, 25, 24, 27, 26);
LiquidCrystal horse15(29, 28, 31, 30, 33, 32);
LiquidCrystal horse14(35, 34, 37, 36, 39, 38);
LiquidCrystal horse13(41, 40, 43, 42, 45, 44);
LiquidCrystal horse12(47, 46, 49, 48, 51, 50);

/*
Made by Michael Pilcher
2/9/2010
*/
int count = 0;
int count1 = 0;

// the 8 arrays that form each segment of the custom numbers
byte LT[8] = 
{
 B00111,
 B01111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111
};
byte UB[8] =
{
 B11111,
 B11111,
 B11111,
 B00000,
 B00000,
 B00000,
 B00000,
 B00000
};
byte RT[8] =
{
 B11100,
 B11110,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111
};
byte LL[8] =
{
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B01111,
 B00111
};
byte LB[8] =
{
 B00000,
 B00000,
 B00000,
 B00000,
 B00000,
 B11111,
 B11111,
 B11111
};
byte LR[8] =
{
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11111,
 B11110,
 B11100
};
byte UMB[8] =
{
 B11111,
 B11111,
 B11111,
 B00000,
 B00000,
 B00000,
 B11111,
 B11111
};
byte LMB[8] =
{
 B11111,
 B00000,
 B00000,
 B00000,
 B00000,
 B11111,
 B11111,
 B11111
};

// loop counter
int x = 0;

 
void setup()
{
 // assignes each segment a write number
 horse23.createChar(8,LT);
 horse23.createChar(1,UB);
 horse23.createChar(2,RT);
 horse23.createChar(3,LL);
 horse23.createChar(4,LB);
 horse23.createChar(5,LR);
 horse23.createChar(6,UMB);
 horse23.createChar(7,LMB);

 horse12.createChar(8,LT);
 horse12.createChar(1,UB);
 horse12.createChar(2,RT);
 horse12.createChar(3,LL);
 horse12.createChar(4,LB);
 horse12.createChar(5,LR);
 horse12.createChar(6,UMB);
 horse12.createChar(7,LMB);

 horse13.createChar(8,LT);
 horse13.createChar(1,UB);
 horse13.createChar(2,RT);
 horse13.createChar(3,LL);
 horse13.createChar(4,LB);
 horse13.createChar(5,LR);
 horse13.createChar(6,UMB);
 horse13.createChar(7,LMB);

 horse14.createChar(8,LT);
 horse14.createChar(1,UB);
 horse14.createChar(2,RT);
 horse14.createChar(3,LL);
 horse14.createChar(4,LB);
 horse14.createChar(5,LR);
 horse14.createChar(6,UMB);
 horse14.createChar(7,LMB);

 horse15.createChar(8,LT);
 horse15.createChar(1,UB);
 horse15.createChar(2,RT);
 horse15.createChar(3,LL);
 horse15.createChar(4,LB);
 horse15.createChar(5,LR);
 horse15.createChar(6,UMB);
 horse15.createChar(7,LMB);
 
 // sets the LCD's rows and colums:
 horse23.begin(16, 2);
 horse12.begin(16,2);
 horse13.begin(16,2);
 horse14.begin(16,2);
 horse15.begin(16,2);

 pinMode(8, OUTPUT);
 digitalWrite(8, HIGH);

 pinMode(12, OUTPUT);
 digitalWrite(12, HIGH);

 pinMode(11, OUTPUT);
 digitalWrite(11, HIGH);

 pinMode(10, OUTPUT);
 digitalWrite(10, HIGH);

 pinMode(9, OUTPUT);
 digitalWrite(9, HIGH);
}

void custom0()
{ // uses segments to build the number 0
 horse23.setCursor(x, 0); // set cursor to column 0, line 0 (first row)
 horse23.write(8);  // call each segment to create
 horse23.write(1);  // top half of the number
 horse23.write(2);
 horse23.setCursor(x, 1); // set cursor to colum 0, line 1 (second row)
 horse23.write(3);  // call each segment to create
 horse23.write(4);  // bottom half of the number
 horse23.write(5);
}

void custom1()
{
 horse23.setCursor(x,0);
 horse23.write(1);
 horse23.write(2);
 horse23.setCursor(x+1,1);
 horse23.write(5);
}

void custom2()
{
 horse23.setCursor(x,0);
 horse23.write(6);
 horse23.write(6);
 horse23.write(2);
 horse23.setCursor(x, 1);
 horse23.write(3);
 horse23.write(7);
 horse23.write(7);
}

void custom3()
{
 horse23.setCursor(x,0);
 horse23.write(6);
 horse23.write(6);
 horse23.write(2);
 horse23.setCursor(x, 1);
 horse23.write(7);
 horse23.write(7);
 horse23.write(5); 
}

void custom4()
{
 horse23.setCursor(x,0);
 horse23.write(3);
 horse23.write(4);
 horse23.write(2);
 horse23.setCursor(x+2, 1);
 horse23.write(5);
}

void custom5()
{
 horse23.setCursor(x,0);
 horse23.write(8);
 horse23.write(6);
 horse23.write(6);
 horse23.setCursor(x, 1);
 horse23.write(7);
 horse23.write(7);
 horse23.write(5);
}

void custom6()
{
 horse23.setCursor(x,0);
 horse23.write(8);
 horse23.write(6);
 horse23.write(6);
 horse23.setCursor(x, 1);
 horse23.write(3);
 horse23.write(7);
 horse23.write(5);
}

void custom7()
{
 horse23.setCursor(x,0);
 horse23.write(1);
 horse23.write(1);
 horse23.write(2);
 horse23.setCursor(x+1, 1);
 horse23.write(8);
}

void custom8()
{
 horse23.setCursor(x,0);
 horse23.write(8);
 horse23.write(6);
 horse23.write(2);
 horse23.setCursor(x, 1);
 horse23.write(3);
 horse23.write(7);
 horse23.write(5);
}

void custom9()
{
 horse23.setCursor(x,0);
 horse23.write(8);
 horse23.write(6);
 horse23.write(2);
 horse23.setCursor(x+2, 1);
 horse23.write(5);
}




void custom01()
{ // uses segments to build the number 0
 horse12.setCursor(x, 0); // set cursor to column 0, line 0 (first row)
 horse12.write(8);  // call each segment to create
 horse12.write(1);  // top half of the number
 horse12.write(2);
 horse12.setCursor(x, 1); // set cursor to colum 0, line 1 (second row)
 horse12.write(3);  // call each segment to create
 horse12.write(4);  // bottom half of the number
 horse12.write(5);
}

void custom11()
{
 horse12.setCursor(x,0);
 horse12.write(1);
 horse12.write(2);
 horse12.setCursor(x+1,1);
 horse12.write(5);
}

void custom21()
{
 horse12.setCursor(x,0);
 horse12.write(6);
 horse12.write(6);
 horse12.write(2);
 horse12.setCursor(x, 1);
 horse12.write(3);
 horse12.write(7);
 horse12.write(7);
}

void custom31()
{
 horse12.setCursor(x,0);
 horse12.write(6);
 horse12.write(6);
 horse12.write(2);
 horse12.setCursor(x, 1);
 horse12.write(7);
 horse12.write(7);
 horse12.write(5); 
}

void custom41()
{
 horse12.setCursor(x,0);
 horse12.write(3);
 horse12.write(4);
 horse12.write(2);
 horse12.setCursor(x+2, 1);
 horse12.write(5);
}

void custom51()
{
 horse12.setCursor(x,0);
 horse12.write(8);
 horse12.write(6);
 horse12.write(6);
 horse12.setCursor(x, 1);
 horse12.write(7);
 horse12.write(7);
 horse12.write(5);
}

void custom61()
{
 horse12.setCursor(x,0);
 horse12.write(8);
 horse12.write(6);
 horse12.write(6);
 horse12.setCursor(x, 1);
 horse12.write(3);
 horse12.write(7);
 horse12.write(5);
}

void custom71()
{
 horse12.setCursor(x,0);
 horse12.write(1);
 horse12.write(1);
 horse12.write(2);
 horse12.setCursor(x+1, 1);
 horse12.write(8);
}

void custom81()
{
 horse12.setCursor(x,0);
 horse12.write(8);
 horse12.write(6);
 horse12.write(2);
 horse12.setCursor(x, 1);
 horse12.write(3);
 horse12.write(7);
 horse12.write(5);
}

void custom91()
{
 horse12.setCursor(x,0);
 horse12.write(8);
 horse12.write(6);
 horse12.write(2);
 horse12.setCursor(x+2, 1);
 horse12.write(5);
}




void custom02()
{ // uses segments to build the number 0
 horse13.setCursor(x, 0); // set cursor to column 0, line 0 (first row)
 horse13.write(8);  // call each segment to create
 horse13.write(1);  // top half of the number
 horse13.write(2);
 horse13.setCursor(x, 1); // set cursor to colum 0, line 1 (second row)
 horse13.write(3);  // call each segment to create
 horse13.write(4);  // bottom half of the number
 horse13.write(5);
}

void custom12()
{
 horse13.setCursor(x,0);
 horse13.write(1);
 horse13.write(2);
 horse13.setCursor(x+1,1);
 horse13.write(5);
}

void custom22()
{
 horse13.setCursor(x,0);
 horse13.write(6);
 horse13.write(6);
 horse13.write(2);
 horse13.setCursor(x, 1);
 horse13.write(3);
 horse13.write(7);
 horse13.write(7);
}

void custom32()
{
 horse13.setCursor(x,0);
 horse13.write(6);
 horse13.write(6);
 horse13.write(2);
 horse13.setCursor(x, 1);
 horse13.write(7);
 horse13.write(7);
 horse13.write(5); 
}

void custom42()
{
 horse13.setCursor(x,0);
 horse13.write(3);
 horse13.write(4);
 horse13.write(2);
 horse13.setCursor(x+2, 1);
 horse13.write(5);
}

void custom52()
{
 horse13.setCursor(x,0);
 horse13.write(8);
 horse13.write(6);
 horse13.write(6);
 horse13.setCursor(x, 1);
 horse13.write(7);
 horse13.write(7);
 horse13.write(5);
}

void custom62()
{
 horse13.setCursor(x,0);
 horse13.write(8);
 horse13.write(6);
 horse13.write(6);
 horse13.setCursor(x, 1);
 horse13.write(3);
 horse13.write(7);
 horse13.write(5);
}

void custom72()
{
 horse13.setCursor(x,0);
 horse13.write(1);
 horse13.write(1);
 horse13.write(2);
 horse13.setCursor(x+1, 1);
 horse13.write(8);
}

void custom82()
{
 horse13.setCursor(x,0);
 horse13.write(8);
 horse13.write(6);
 horse13.write(2);
 horse13.setCursor(x, 1);
 horse13.write(3);
 horse13.write(7);
 horse13.write(5);
}

void custom92()
{
 horse13.setCursor(x,0);
 horse13.write(8);
 horse13.write(6);
 horse13.write(2);
 horse13.setCursor(x+2, 1);
 horse13.write(5);
}




void custom03()
{ // uses segments to build the number 0
 horse14.setCursor(x, 0); // set cursor to column 0, line 0 (first row)
 horse14.write(8);  // call each segment to create
 horse14.write(1);  // top half of the number
 horse14.write(2);
 horse14.setCursor(x, 1); // set cursor to colum 0, line 1 (second row)
 horse14.write(3);  // call each segment to create
 horse14.write(4);  // bottom half of the number
 horse14.write(5);
}

void custom13()
{
 horse14.setCursor(x,0);
 horse14.write(1);
 horse14.write(2);
 horse14.setCursor(x+1,1);
 horse14.write(5);
}

void custom23()
{
 horse14.setCursor(x,0);
 horse14.write(6);
 horse14.write(6);
 horse14.write(2);
 horse14.setCursor(x, 1);
 horse14.write(3);
 horse14.write(7);
 horse14.write(7);
}

void custom33()
{
 horse14.setCursor(x,0);
 horse14.write(6);
 horse14.write(6);
 horse14.write(2);
 horse14.setCursor(x, 1);
 horse14.write(7);
 horse14.write(7);
 horse14.write(5); 
}

void custom43()
{
 horse14.setCursor(x,0);
 horse14.write(3);
 horse14.write(4);
 horse14.write(2);
 horse14.setCursor(x+2, 1);
 horse14.write(5);
}

void custom53()
{
 horse14.setCursor(x,0);
 horse14.write(8);
 horse14.write(6);
 horse14.write(6);
 horse14.setCursor(x, 1);
 horse14.write(7);
 horse14.write(7);
 horse14.write(5);
}

void custom63()
{
 horse14.setCursor(x,0);
 horse14.write(8);
 horse14.write(6);
 horse14.write(6);
 horse14.setCursor(x, 1);
 horse14.write(3);
 horse14.write(7);
 horse14.write(5);
}

void custom73()
{
 horse14.setCursor(x,0);
 horse14.write(1);
 horse14.write(1);
 horse14.write(2);
 horse14.setCursor(x+1, 1);
 horse14.write(8);
}

void custom83()
{
 horse14.setCursor(x,0);
 horse14.write(8);
 horse14.write(6);
 horse14.write(2);
 horse14.setCursor(x, 1);
 horse14.write(3);
 horse14.write(7);
 horse14.write(5);
}

void custom93()
{
 horse14.setCursor(x,0);
 horse14.write(8);
 horse14.write(6);
 horse14.write(2);
 horse14.setCursor(x+2, 1);
 horse14.write(5);
}





void custom04()
{ // uses segments to build the number 0
 horse15.setCursor(x, 0); // set cursor to column 0, line 0 (first row)
 horse15.write(8);  // call each segment to create
 horse15.write(1);  // top half of the number
 horse15.write(2);
 horse15.setCursor(x, 1); // set cursor to colum 0, line 1 (second row)
 horse15.write(3);  // call each segment to create
 horse15.write(4);  // bottom half of the number
 horse15.write(5);
}

void custom14()
{
 horse15.setCursor(x,0);
 horse15.write(1);
 horse15.write(2);
 horse15.setCursor(x+1,1);
 horse15.write(5);
}

void custom24()
{
 horse15.setCursor(x,0);
 horse15.write(6);
 horse15.write(6);
 horse15.write(2);
 horse15.setCursor(x, 1);
 horse15.write(3);
 horse15.write(7);
 horse15.write(7);
}

void custom34()
{
 horse15.setCursor(x,0);
 horse15.write(6);
 horse15.write(6);
 horse15.write(2);
 horse15.setCursor(x, 1);
 horse15.write(7);
 horse15.write(7);
 horse15.write(5); 
}

void custom44()
{
 horse15.setCursor(x,0);
 horse15.write(3);
 horse15.write(4);
 horse15.write(2);
 horse15.setCursor(x+2, 1);
 horse15.write(5);
}

void custom54()
{
 horse15.setCursor(x,0);
 horse15.write(8);
 horse15.write(6);
 horse15.write(6);
 horse15.setCursor(x, 1);
 horse15.write(7);
 horse15.write(7);
 horse15.write(5);
}

void custom64()
{
 horse15.setCursor(x,0);
 horse15.write(8);
 horse15.write(6);
 horse15.write(6);
 horse15.setCursor(x, 1);
 horse15.write(3);
 horse15.write(7);
 horse15.write(5);
}

void custom74()
{
 horse15.setCursor(x,0);
 horse15.write(1);
 horse15.write(1);
 horse15.write(2);
 horse15.setCursor(x+1, 1);
 horse15.write(8);
}

void custom84()
{
 horse15.setCursor(x,0);
 horse15.write(8);
 horse15.write(6);
 horse15.write(2);
 horse15.setCursor(x, 1);
 horse15.write(3);
 horse15.write(7);
 horse15.write(5);
}

void custom94()
{
 horse15.setCursor(x,0);
 horse15.write(8);
 horse15.write(6);
 horse15.write(2);
 horse15.setCursor(x+2, 1);
 horse15.write(5);
}


void loop()
{
 x = 7;

count = random(1,201);

if (count > 99)   // 100 - 200
  {
    count1 = count * .01;   // 123 = 1.23    
    count1 = (int)count1;

// first digit if over 99

    x = 3;
    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); }

// second digit if over 99

  count1 = count * .1; // 200 = 20.0
  count1 = (int)count1; // 20

  if (count1 == 20) { count1 = 0; }   // if 20, now 0
  else { count1 = count1 - 10; }   // if 17, now 7

  x = 7;

    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); }

// third digit if over 99

  count1 = count * .1;   // 123 = 12.3
  count1 = (int)count1; // 12
  count1 = count1 * 10;  // 120
  count1 = count - count1;   // 123 - 120  = 3

  x = 11;

    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); }

  
  }

if (count < 100 && count > 9)
  {

  // count = 23

  count1 = count * .1;   // 2.3
  count1 = (int)count1; // 2

  x = 5;

    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); }

// third digit if over 99

  count1 = count * .1;   // 23 = 2.3
  count1 = (int)count1; // 2
  count1 = count1 * 10;  // 20
  count1 = count - count1;   // 23 - 20  = 3

  x = 9;

    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); }  
  }

if (count < 10)
  {
        x = 7;
    if (count1 == 0) { custom0(); }
    if (count1 == 1) { custom1(); }
    if (count1 == 2) { custom2(); }
    if (count1 == 3) { custom3(); }
    if (count1 == 4) { custom4(); }
    if (count1 == 5) { custom5(); }
    if (count1 == 6) { custom6(); }
    if (count1 == 7) { custom7(); }
    if (count1 == 8) { custom8(); }
    if (count1 == 9) { custom9(); } 
  }


// horse15

count = random(1,201);

if (count > 99)   // 100 - 200
  {
    count1 = count * .01;   // 123 = 1.23    
    count1 = (int)count1;

// first digit if over 99

    x = 3;
    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }

// second digit if over 99

  count1 = count * .1; // 200 = 20.0
  count1 = (int)count1; // 20

  if (count1 == 20) { count1 = 0; }   // if 20, now 0
  else { count1 = count1 - 10; }   // if 17, now 7

  x = 7;

    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }

// third digit if over 99

  count1 = count * .1;   // 123 = 12.3
  count1 = (int)count1; // 12
  count1 = count1 * 10;  // 120
  count1 = count - count1;   // 123 - 120  = 3

  x = 11;

    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }

  
  }

if (count < 100 && count > 9)
  {

  // count = 23

  count1 = count * .1;   // 2.3
  count1 = (int)count1; // 2

  x = 5;

    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }

// third digit if over 99

  count1 = count * .1;   // 23 = 2.3
  count1 = (int)count1; // 2
  count1 = count1 * 10;  // 20
  count1 = count - count1;   // 23 - 20  = 3

  x = 9;

    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }
  }

if (count < 10)
  {
        x = 7;
    if (count1 == 0) { custom01(); }
    if (count1 == 1) { custom11(); }
    if (count1 == 2) { custom21(); }
    if (count1 == 3) { custom31(); }
    if (count1 == 4) { custom41(); }
    if (count1 == 5) { custom51(); }
    if (count1 == 6) { custom61(); }
    if (count1 == 7) { custom71(); }
    if (count1 == 8) { custom81(); }
    if (count1 == 9) { custom91(); }
  }

// horse15

count = random(1,201);

if (count > 99)   // 100 - 200
  {
    count1 = count * .01;   // 123 = 1.23    
    count1 = (int)count1;

// first digit if over 99

    x = 3;
    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }

// second digit if over 99

  count1 = count * .1; // 200 = 20.0
  count1 = (int)count1; // 20

  if (count1 == 20) { count1 = 0; }   // if 20, now 0
  else { count1 = count1 - 10; }   // if 17, now 7

  x = 7;
    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }

// third digit if over 99

  count1 = count * .1;   // 123 = 12.3
  count1 = (int)count1; // 12
  count1 = count1 * 10;  // 120
  count1 = count - count1;   // 123 - 120  = 3

  x = 11;

    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }

  
  }

if (count < 100 && count > 9)
  {

  // count = 23

  count1 = count * .1;   // 2.3
  count1 = (int)count1; // 2

  x = 5;

    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }

// third digit if over 99

  count1 = count * .1;   // 23 = 2.3
  count1 = (int)count1; // 2
  count1 = count1 * 10;  // 20
  count1 = count - count1;   // 23 - 20  = 3

  x = 9;

    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }
  }

if (count < 10)
  {
        x = 7;
    if (count1 == 0) { custom03(); }
    if (count1 == 1) { custom13(); }
    if (count1 == 2) { custom23(); }
    if (count1 == 3) { custom33(); }
    if (count1 == 4) { custom43(); }
    if (count1 == 5) { custom53(); }
    if (count1 == 6) { custom63(); }
    if (count1 == 7) { custom73(); }
    if (count1 == 8) { custom83(); }
    if (count1 == 9) { custom93(); }
  }

  // horse15

count = random(1,201);

if (count > 99)   // 100 - 200
  {
    count1 = count * .01;   // 123 = 1.23    
    count1 = (int)count1;

// first digit if over 99

    x = 3;
    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }

// second digit if over 99

  count1 = count * .1; // 200 = 20.0
  count1 = (int)count1; // 20

  if (count1 == 20) { count1 = 0; }   // if 20, now 0
  else { count1 = count1 - 10; }   // if 17, now 7

  x = 7;
    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }

// third digit if over 99

  count1 = count * .1;   // 123 = 12.3
  count1 = (int)count1; // 12
  count1 = count1 * 10;  // 120
  count1 = count - count1;   // 123 - 120  = 3

  x = 11;

    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }

  
  }

if (count < 100 && count > 9)
  {

  // count = 23

  count1 = count * .1;   // 2.3
  count1 = (int)count1; // 2

  x = 5;

    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }

// third digit if over 99

  count1 = count * .1;   // 23 = 2.3
  count1 = (int)count1; // 2
  count1 = count1 * 10;  // 20
  count1 = count - count1;   // 23 - 20  = 3

  x = 9;

    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }
  }

if (count < 10)
  {
        x = 7;
    if (count1 == 0) { custom02(); }
    if (count1 == 1) { custom12(); }
    if (count1 == 2) { custom22(); }
    if (count1 == 3) { custom32(); }
    if (count1 == 4) { custom42(); }
    if (count1 == 5) { custom52(); }
    if (count1 == 6) { custom62(); }
    if (count1 == 7) { custom72(); }
    if (count1 == 8) { custom82(); }
    if (count1 == 9) { custom92(); }
  }


  // horse15

count = random(1,201);

if (count > 99)   // 100 - 200
  {
    count1 = count * .01;   // 123 = 1.23    
    count1 = (int)count1;

// first digit if over 99

    x = 3;
    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }

// second digit if over 99

  count1 = count * .1; // 200 = 20.0
  count1 = (int)count1; // 20

  if (count1 == 20) { count1 = 0; }   // if 20, now 0
  else { count1 = count1 - 10; }   // if 17, now 7

  x = 7;
    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }

// third digit if over 99

  count1 = count * .1;   // 123 = 12.3
  count1 = (int)count1; // 12
  count1 = count1 * 10;  // 120
  count1 = count - count1;   // 123 - 120  = 3

  x = 11;

    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }

  
  }

if (count < 100 && count > 9)
  {

  // count = 23

  count1 = count * .1;   // 2.3
  count1 = (int)count1; // 2

  x = 5;

    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }

// third digit if over 99

  count1 = count * .1;   // 23 = 2.3
  count1 = (int)count1; // 2
  count1 = count1 * 10;  // 20
  count1 = count - count1;   // 23 - 20  = 3

  x = 9;

    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }
  }

if (count < 10)
  {
    x = 7;
    if (count1 == 0) { custom04(); }
    if (count1 == 1) { custom14(); }
    if (count1 == 2) { custom24(); }
    if (count1 == 3) { custom34(); }
    if (count1 == 4) { custom44(); }
    if (count1 == 5) { custom54(); }
    if (count1 == 6) { custom64(); }
    if (count1 == 7) { custom74(); }
    if (count1 == 8) { custom84(); }
    if (count1 == 9) { custom94(); }
  }

delay(3000);

horse23.clear();
horse12.clear();
horse13.clear();
horse14.clear();
horse15.clear();

 
}


Build Part 4D

In this video, we make the countdown clock count from 30 to 1

Countdown Clock Arduino Code


    
    // include the library
    #include 
    
    // initialize the interface pins
    LiquidCrystal lcd(12, 13, 11, 10, 9, 8);
    
    int x = 0;
    
    int count = 30;
    int count1 = 0;
    
    // the 8 arrays that form each segment of the custom numbers
    byte LT[8] = 
    {
      B00111,
      B01111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111
    };
    byte UB[8] =
    {
      B11111,
      B11111,
      B11111,
      B00000,
      B00000,
      B00000,
      B00000,
      B00000
    };
    byte RT[8] =
    {
      B11100,
      B11110,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111
    };
    byte LL[8] =
    {
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B01111,
      B00111
    };
    byte LB[8] =
    {
      B00000,
      B00000,
      B00000,
      B00000,
      B00000,
      B11111,
      B11111,
      B11111
    };
    byte LR[8] =
    {
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11111,
      B11110,
      B11100
    };
    byte UMB[8] =
    {
      B11111,
      B11111,
      B11111,
      B00000,
      B00000,
      B00000,
      B11111,
      B11111
    };
    byte LMB[8] =
    {
      B11111,
      B00000,
      B00000,
      B00000,
      B00000,
      B11111,
      B11111,
      B11111
    };
    
    
    
    void setup()
    {
      // assignes each segment a write number
      lcd.createChar(8,LT);
      lcd.createChar(1,UB);
      lcd.createChar(2,RT);
      lcd.createChar(3,LL);
      lcd.createChar(4,LB);
      lcd.createChar(5,LR);
      lcd.createChar(6,UMB);
      lcd.createChar(7,LMB);
      pinMode(9, OUTPUT);  
      analogWrite(9, 50);  
      // sets the LCD's rows and colums:
      lcd.begin(0, 2);
      pinMode(7, OUTPUT);
      digitalWrite(7, HIGH);
    }
    
    void custom0O()
    { // uses segments to build the number 0
      lcd.setCursor(x, 0); 
      lcd.write(8);  
      lcd.write(1); 
      lcd.write(2);
      lcd.setCursor(x, 1); 
      lcd.write(3);  
      lcd.write(4);  
      lcd.write(5);
    }
    
    void custom1()
    {
      lcd.setCursor(x,0);
      lcd.write(1);
      lcd.write(2);
      lcd.setCursor(x+1,1);
      lcd.write(255);
    }
    
    void custom2()
    {
      lcd.setCursor(x,0);
      lcd.write(6);
      lcd.write(6);
      lcd.write(2);
      lcd.setCursor(x, 1);
      lcd.write(3);
      lcd.write(7);
      lcd.write(7);
    }
    
    void custom3()
    {
      lcd.setCursor(x,0);
      lcd.write(6);
      lcd.write(6);
      lcd.write(2);
      lcd.setCursor(x, 1);
      lcd.write(7);
      lcd.write(7);
      lcd.write(5); 
    }
    
    void custom4()
    {
      lcd.setCursor(x,0);
      lcd.write(3);
      lcd.write(4);
      lcd.write(2);
      lcd.setCursor(x+2, 1);
      lcd.write(255);
    }
    
    void custom5()
    {
      lcd.setCursor(x,0);
      lcd.write(255);
      lcd.write(6);
      lcd.write(6);
      lcd.setCursor(x, 1);
      lcd.write(7);
      lcd.write(7);
      lcd.write(5);
    }
    
    void custom6()
    {
      lcd.setCursor(x,0);
      lcd.write(8);
      lcd.write(6);
      lcd.write(6);
      lcd.setCursor(x, 1);
      lcd.write(3);
      lcd.write(7);
      lcd.write(5);
    }
    
    void custom7()
    {
      lcd.setCursor(x,0);
      lcd.write(1);
      lcd.write(1);
      lcd.write(2);
      lcd.setCursor(x+1, 1);
      lcd.write(8);
    }
    
    void custom8()
    {
      lcd.setCursor(x,0);
      lcd.write(8);
      lcd.write(6);
      lcd.write(2);
      lcd.setCursor(x, 1);
      lcd.write(3);
      lcd.write(7);
      lcd.write(5);
    }
    
    void custom9()
    {
      lcd.setCursor(x,0);
      lcd.write(8);
      lcd.write(6);
      lcd.write(2);
      lcd.setCursor(x+2, 1);
      lcd.write(255);
    }
    
    void loop()
    {
      if ( count > 9 )
      {
        count1 = int(count * .1); // 23 = 2
        x = 5;
        if (count1 == 3) { custom3(); }
        if (count1 == 2) { custom2(); }
        if (count1 == 1) { custom1(); }
        
        count1 = int(count * .1); // 23 = 2
        count1 = count1 * 10;  // 2 = 20
        count1 = count - count1; // 23 - 20 = 3
        
        x = 9;
        
        if (count1 == 9) { custom9(); }
        if (count1 == 8) { custom8(); }
        if (count1 == 7) { custom7(); }
        if (count1 == 6) { custom6(); }
        if (count1 == 5) { custom5(); }
        if (count1 == 4) { custom4(); }
        if (count1 == 3) { custom3(); }
        if (count1 == 2) { custom2(); }
        if (count1 == 1) { custom1(); }
        if (count1 == 0) { custom0O(); }
    }
    
    if ( count < 10)
    {
        x = 7;
        
        if (count == 9) { custom9(); }
        if (count == 8) { custom8(); }
        if (count == 7) { custom7(); }
        if (count == 6) { custom6(); }
        if (count == 5) { custom5(); }
        if (count == 4) { custom4(); }
        if (count == 3) { custom3(); }
        if (count == 2) { custom2(); }
        if (count == 1) { custom1(); }
        if (count == 0) { custom0O(); }
    }
    
    count--;
    delay(500);
    lcd.clear();
    
    if (count == 0)
    {
      digitalWrite(7, LOW);
      delay(2000);
      digitalWrite(7, HIGH);
      count = 30;
    }
}