O'Reilly logo

Mastering Arduino by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying text

The Adafruit library also makes it very easy to display text to the Nokia 5110 LCD. The following code shows how we can display text:

// Display text
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
display.println("Hello, world!");

// Display Reverse Text
display.setTextColor(WHITE, BLACK);
display.println(3.14);

// Display Larger Text
display.setTextSize(2);
display.setTextColor(BLACK);
display.print("This is larger text");
display.display();

The setTextSize() function sets the size of the text. In the first example, the text size is set to 1. The setTextColor() function will set the color of the text. Once again, since the Nokia 5110 LCD is a monochrome display, the two options are BLACK or ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required