It would be useful to be able to display numbers (integers between 0 and 999, for example) in jumbo size on the EV3 display so that they can be read easily even while the robot is moving.
My solution was to display three images side by side on the screen, with each image showing a digit. I prepared the image files for each digit 0-9 using the GIMP program then imported them into the EV3 Image Editor and placed each of them at the extreme left of the EV3 screen.
Then a rather clever EV3 program does this:
Here is more detail on the fiendishly clever calculation which uses the index number of the loop as well as modulo and 'floor' rounding to determine the corresponding digit. Here is the formula used: floor(a%(10^(3-b))/(10^(2-b)))
where a is the reading of the ultrasound sensor, as stored in the variable 'dist'
and b is the inner loop's count output.
Note that
The best way to understand the calculation is to see how it works with a specific number such as a=245.
On the first passage through the inner loop its count output is zero (=b).
10^(3-b) = 10^3=1000
a%(10^(3-b))= 245%1000 = 245 (the remainder when 245 is divided by 1000)
10^(2-b)=10^2=100
a%(10^(3-b))/(10^(2-b))=245/100=2.45
floor(a%(10^(3-b))/(10^(2-b)))=floor(2.45)=2 ('floor' just means 'round down')
so the first digit of the reading has been determined to be a '2' and this number is passed to the display block causing the image file with the name '2' to be displayed.
On the second passage through the inner loop its count output is 1(=b).
10^(3-b) = 10^2=100
a%(10^(3-b))= 245%100 = 45 (the remainder when 245 is divided by 100)
10^(2-b)=10^1=10
a%(10^(3-b))/(10^(2-b))=45/10=4.5
floor(a%(10^(3-b))/(10^(2-b)))=floor(4.5)=4 ('floor' just means 'round down')
so the second digit of the reading has been determined to be a '4' and this number is passed to the display block causing the image file with the name '4' to be displayed, just to the right of the first digit (59 pixels to the right, to be exact).
I'll leave it to you to check that the third pass (iteration) through the loop gives the output '5' as expected.
If I had tried to determine each digit separately instead of using a loop to find all three digits then the code in each part would have been simpler, but there would have been three parts instead of one. Other improvements could be to hide leading zero(s) so that sixty five, for example, would appear as 65 and not 065. My program is incapable of displaying negative numbers or decimal parts. I don't know how it would handle numbers larger than 999 - it is certainly not designed to handle numbers larger than this.
Use the link below to download the project, which includes the 10 image files. The project also includes a second, much simpler project which continually displays the ultrasound sensor reading using the regular built-in type 2 font which is larger than type 1 but tiny compared to the digits that my program displays. So, was it worth it?