user25543: How would I split part1 into 2-3 digits and put them into num1, num2, and num3?
int FMSTATION = 10250;

int update_display() {
  int fm_station = FMSTATION ;

  int part1;
  int part2;

  part1 = (FMSTATION / 100);
  part2 = (FMSTATION % 100);
  part2 = (part2/10);

  int num1 = ;
  int num2 = ;
  int num3 = ;
  int num4 = part2;

  matrix.writeDigitNum(0, num1, false);  //1st number on lcd
  matrix.writeDigitNum(1, num2, false);  //2nd number on lcd
  matrix.writeDigitNum(3, num3, true);   //3rd number on lcd and adds "."
  matrix.writeDigitNum(4, num4, false);  //4th number on lcd

  matrix.writeDisplay();
}

I have searched the web from top to bottom, but could not find the answer. In the end what I should get displayed on my LCD is 102.5.

user24064: I think this will help you:
int FMSTATION = 10250;
int update_display() {
  int fm_station = FMSTATION ;

  int part1;
  int part2; 
  part1 = (FMSTATION / 100); //102
  part2 = (FMSTATION % 100); //50
  part2 = (part2/10); //5

  int num1 = part1/100; //1
  int num2 = (part1 % 100)/10; //0
  int num3 = part1%10; //2
  int num4 = part2; //5

  matrix.writeDigitNum(0, num1, false); //1st number on lcd
  matrix.writeDigitNum(1, num2, false); //2nd number on lcd
  matrix.writeDigitNum(3, num3, true); //3rd number on lcd and adds "."
  matrix.writeDigitNum(4, num4, false); //4th number on lcd

  matrix.writeDisplay();
}


user4143: % 10 returns the final digit of a number. Dividing by 10 shifts the number one digit to the right.
So if you have the number 10250 as an integer you can get at each number with:
10250 % 10 = 0
(10250 / 10) % 10 = 5
(10250 / 100) % 10 = 2
(10250 / 1000) % 10 = 0
(10250 / 10000) % 10 = 1

So your code could be written as:
num4 = (fm_station / 10) % 10;
num3 = (fm_station / 100) % 10;
num2 = (fm_station / 1000) % 10;
num1 = (fm_station / 10000) % 10;

No need to mess with "part" variables.

25543: <p>How would I split <code>part1</code> into 2-3 digits and put them into <code>num1</code>, <code>num2</code>, and <code>num3</code>?</p>

<pre><code>int FMSTATION = 10250;

int update_display() {
  int fm_station = FMSTATION ;

  int part1;
  int part2;

  part1 = (FMSTATION / 100);
  part2 = (FMSTATION % 100);
  part2 = (part2/10);

  int num1 = ;
  int num2 = ;
  int num3 = ;
  int num4 = part2;

  matrix.writeDigitNum(0, num1, false);  //1st number on lcd
  matrix.writeDigitNum(1, num2, false);  //2nd number on lcd
  matrix.writeDigitNum(3, num3, true);   //3rd number on lcd and adds "."
  matrix.writeDigitNum(4, num4, false);  //4th number on lcd

  matrix.writeDisplay();
}
</code></pre>

<p>I have searched the web from top to bottom, but could not find the answer. In the end what I should get displayed on my LCD is <code>102.5</code>.</p>
 24064: <p>I think this will help you:</p>

<pre><code>int FMSTATION = 10250;
int update_display() {
  int fm_station = FMSTATION ;

  int part1;
  int part2; 
  part1 = (FMSTATION / 100); //102
  part2 = (FMSTATION % 100); //50
  part2 = (part2/10); //5

  int num1 = part1/100; //1
  int num2 = (part1 % 100)/10; //0
  int num3 = part1%10; //2
  int num4 = part2; //5

  matrix.writeDigitNum(0, num1, false); //1st number on lcd
  matrix.writeDigitNum(1, num2, false); //2nd number on lcd
  matrix.writeDigitNum(3, num3, true); //3rd number on lcd and adds "."
  matrix.writeDigitNum(4, num4, false); //4th number on lcd

  matrix.writeDisplay();
}
</code></pre>
 4143: <p><code>% 10</code> returns the final digit of a number. Dividing by 10 shifts the number one digit to the right.</p>

<p>So if you have the number 10250 as an integer you can get at each number with:</p>

<pre><code>10250 % 10 = 0
(10250 / 10) % 10 = 5
(10250 / 100) % 10 = 2
(10250 / 1000) % 10 = 0
(10250 / 10000) % 10 = 1
</code></pre>

<p>So your code could be written as:</p>

<pre><code>num4 = (fm_station / 10) % 10;
num3 = (fm_station / 100) % 10;
num2 = (fm_station / 1000) % 10;
num1 = (fm_station / 10000) % 10;
</code></pre>

<p>No need to mess with "part" variables.</p>
