Welcome back fellow arduidans!
After reviewing Chapter Six of our tutorials, I felt that there was some important information missing about the section regarding driving 4-digit 7-segment LED display modules. Although we have discussed displaying numbers using the module, and hopefully you have done this yourself with exercise 6.2, those numbers were constantly being written to the display as the sensor was being repeatedly read.
But how do we send a number to the display – and hold it there? We need a function that can accept the number to display – and the length of time (in cycles) to hold it there. I have rewritten the function displaynumber() from the solution to exercise 6.2 – now it accepts another value, “cycles”. This is the number of times the number will be shown on the display.
void displaynumber(int rawnumber, int cycles)
// takes an integer and displays it on our 4-digit LED display module and HOLDS it on the display for 'cycles' number of cycles
for (int q=1; q<=cycles; q++)
if (rawnumber>=0 && rawnumber<10)
else if (rawnumber>=10 && rawnumber<100)
else if (rawnumber>=100 && rawnumber<1000)
else if (rawnumber>=1000)
Here is a sketch to demonstrate this function, the hardware is the same as exercise 6.2, except there is no need for the variable resistor.
And my day wouldn’t be complete without another video demonstration. This example has cycles set to 500.
So there you have it! Now you have the knowledge to use these multi-digit displays effectively. And now that we have mastered them, we can move onto more interesting and useful display types. In the meanwhile, off to Chapter Seven.
Have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Latest posts by John Boxall (see all)
- First Look – Arduino M0 Pro with 32 bit ARM Cortex M0 - October 28, 2015
- Control your Arduino over the Internet using Blynk - September 20, 2015
- Experimenting with Arduino and IKEA DIODER LED Strips - September 19, 2015