Arduino Uno Q In C - Text On The LED Matrix
Written by Harry Fairhead   
Monday, 26 January 2026
Article Index
Arduino Uno Q In C - Text On The LED Matrix
ArduinoGraphics

ArduinoGraphics

You can get a long way just using the matrix library, but there is another library, ArduinoGraphics, that has additional functions that make the LED matrix really useful. However, at the time of writing support for this library isn’t complete and you need to test it out before deciding that it works.

The idea of the ArduinoGraphics is that it can supply standard graphics functions for a range of different displays, in this case the LED matrix.

It includes the following functions:

  • begin()            Initialize graphics
  • end()               Stop using graphics
  • width()            Return width of canvas
  • height()           Return height of canvas
  • beginDraw()   Start drawing
  • endDraw()      End drawing and display result
  • clear()            Clear canvas
  • clear(x,y)        Clear pixel
  • fill(r,g,b)         Set fill color
  • noFill()           No fill color
  • stroke(r,g,b)   Set stroke color
  • noStroke()     No stroke color

  • line(x1,y1,x2,y2) Draw line between (x1,y1) and (x2,y2)
  • point(x,y)             Draw point at (x,y) in stroke color
  • set(x,y,r,g,b)        Draw point at (x.y) in color rgb
  • rect(x1,y1,x2,y2) Draw rectangle corners at (x1,y1)(x2,y2)
  • circle(x,y,d)          Draw circle diameter d center (x,y)
  • ellipse(x,y,h,w)     Draw ellipse h high and w wide center (x,y)
  • text(string, x, y)    Draw string text starting at (x,y)

  • beginText(x, y, r, g, b)  Start position and color of text
  • print(string)                  Print text at start and in color
  • endText(scrollDir)        End printing text where scrollDir =                                                 NO_SCROLL, SCROLL_LEFT,
                                             SCROLL_RIGHT, SCROLL_UP,
                                             SCROLL_DOWN
  • textFont(font)                Set font = Font_5x7 or Font_4x6
  • textFontWidth()             Returns width of font
  • textFontHeight()            Returns height of font
  • textSize(sX, sY)            Scale font
  • textScrollSpeed(s)        Scroll speed s in ms

Mostly the way that the functions work is obvious. For example, matrix4 draws a circle:

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>
Arduino_LED_Matrix matrix;
void setup() {
  matrix.begin();
  matrix.beginDraw();
  matrix.stroke(0,0,255);
  matrix.fill(1, 0, 0);
  matrix.circle( 6, 3, 5);
  matrix.endDraw();
}
void loop() {
}

If you try this out you will discover that at this resolution a circle looks a lot like a square. Notice that adding:

#include <ArduinoGraphics.h>

before

#include <Arduino_LED_Matrix.h>

causes the graphics methods to be added to the Matrix class.

One particularly useful feature is the ability to display text. This turns the LED matrix into a way of communicating the state of things as for example with this code: matrix5:

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>
Arduino_LED_Matrix matrix;
char text[]="Core Melt Down Warning";
void setup() {
  matrix.begin();
  matrix.textFont(Font_5x7);
  matrix.textScrollSpeed(100);
  matrix.clear(); 
}
void loop() {
  matrix.beginText(0, 1, 1, 0, 0);  
  matrix.print(text);
  matrix.endText(SCROLL_LEFT);
}

Notice that we are using beginText rather than text, but either will do the job. Also notice that SCROLL_LEFT causes endText to block until the entire text has been displayed. After this, it isn’t difficult to see how to construct a function to display text from within a program.

Using the Bridge you can also display messages from the ARM A55 on the LED Matrix - see Chapter 16.

Summary 

  • PWM, Pulse Width Modulation, has a fixed repetition rate but a variable duty cycle, i.e. the amount of time the signal is high or low changes.

  • PWM can be generated by software simply by changing the state of a GPIO line correctly, but it can also be generated in hardware so relieving the processor of some work.

  • As well as being a way of signaling, PWM can also be used to vary the amount of power or voltage transferred. The higher the duty cycle, the more power/voltage.

  • The STM32 has 8 hardware PWM generators. These can be used with any of the GPIO lines but the Arduino core limits them to the standard five lines.

  • The higher the frequency of the PWM, the lower the duty cycle resolution.

  • The frequency of the Arduino Core PWM lines is fixed at 500Hz

  • You can modify the frequency and duty cycle of a running PWM generator using Zephyr functions.

  • PWM can be used to implement digital-to-analog conversion simply by varying the duty cycle. You can dim an LED in the same way.

  • The PWM controllers can be set to auto fade an LED by varying the duty cycle.

  • The Arduino_LED_Matrix and ArduinoGraphics libraries can be used to display graphics and text.

  • The LED matrix makes use of PWM to implement grayscale displays.

Programming The Uno Q In C 
Using Arduino Core & Zephyr

By Harry Fairhead

unoqC360

Available as a softback, hardback and kindle from Amazon in the first week of February

Contents

       Preface

  1. The Uno Q – Before We Begin
  2. Getting Started
  3. Getting Started With GPIO
  4. Simple Output 
  5. Some Electronics
  6. Simple Input
  7. Advanced Input – Interrupts
  8. Pulse Width Modulation
      Extract: 
    Text On The LED Matrix ***NEW!!!
  9. Controlling Motors And Servos
  10. Getting Started With The SPI Bus
  11. Using Analog Sensors
  12. Using The I2C Bus
  13. One-Wire Protocols
  14. Zephyr For Task Management
  15. Zephyr Devices
  16. The Bridge 

pico book

 

Comments




or email your comment to: comments@i-programmer.info

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Facebook or Linkedin.



Last Updated ( Tuesday, 27 January 2026 )