Lesson 7 - 4x7 segment display

We've been using the Multi Functional Shield to fulfil basic requirements such as using the LED or a Button. We will now be looking at this shield in more detail, controlling the 4x7 segment display using the library for the MFS. This library gives us access to additional functions, when programming to control sensors and modules on the board.

What is a 7-segment display?

A 7-segment display consists of 7 internal LEDs which are denoted from A-G, with the 8th segment labelled as the decimal point. This is controlled to display numerical values, but can also display certain alphabetical letters.

The Arduino MFS has an integrated 4x7 display unit and we can use this to write 4 digit numbers as well as 4 letter words. However, not all alphabetical characters can be visualised due to the format of the 7-segment display.

Installing the MFS Library

The Multi Functional Shield has its own custom library which allows us to use functions when programming. These functions allow us to program and use the sensors and modules on the shield.

Using the following link you can download the .zip library file:


Once, the file has been installed to the PC, we must add this to the IDE. To add a third party library to the Arduino IDE, got to Sketch > Include Library > Add .ZIP Library > Select the file. To install libraries which are supported by Arduino.cc, you can search for them in the library manager. Tools > Manage Libraries.

Setting up the sketch

We will be using the MFS to display numerical and alphabetical data on to the 4x7 segment display. To begin with, we need to include two libraries to our sketch, the MFS library and TimerOne library. The timer library is used in accordance with the MFS library for fine pulse width modulation control and to run a periodic interrupt.

To include a library to our sketch, we use the below line of code, with the library name stated respectively:

#include <LibraryName.h>

In the setup, we need to initialise the libraries. The timer library is independent, whereas the MFS library is dependent on the timer library. This is how to ensure they are setup correctly to avoid syntax errors:

Using the 4x7 Segment Display

Once all of this is done, we are now ready to use features, sensors and modules on the MFS. To use the 4x7 segment display, there is one simple function we use:

MFS.write('----'); //whatever is enclosed in the speech marks will be displayed

MFS.write(var); //take the data from the variable name and write it to the display

This function can be used throughout our program now and we can use it to display count values, digital status and much more.

By Zaqyas Mahmood, Electronics Engineer