Zumo 32U4 Simple LCD Display Test

I realized that before we can work on reading the light sensors, we probably should cover an easy way to display the data.  There are a couple of ways to display data on the Zumo.  One, which we will cover later, is to use the serial monitor.  This is a method of communicating between the Arduino and your computer over USB to send data.  This is a great method, and we will get to it later.  However, another method is to simply write the information to the LCD on the robot.  This can be useful as it allows you to see the data without being tethered to a computer.
In this post, we will simply just write the customary “Hello World” statement to the display.  Like previous posts, we need to include the Zumo32U4 library, and it is always helpful to create a shorten name for the class that we are using.  The class for driving the LCD is Zumo32U4LCD, and let’s create an instance of it and call it simply “lcd.”  Both of these steps are done in the lines:
#include <Zumo32U4.h>
Zumo32U4LCD lcd; 
 Since we are just displaying once, we will put everything in the setup().  In this case, loop will be empty.  The LCD displays the items that you tell it, then it holds the display and does not need to be refreshed until you want to do something different with it.  There are a couple of commands that you will need.  The first is:
lcd.clear();
 This simply clears the display.  In a lot of cases, the display is already clear, but sometimes, it has remnants from previous programs.  It is always a good idea to clear the display.  The next step is that we need to tell the display where to write our message.  The display has 2 lines of 8 characters.  We cannot write the entire display to a single line, so let’s split it on two lines.  We need to specify that we want to start the first line at the far left position.  The LCD positions start at 0.  The first line, left most position would be (0,0).  We can specify that we want to start there with the following command:
lcd.gotoXY(0,0);
Then to print the word “Hello,” we would use:
lcd.print("Hello");
Writing the word “World” is the same method, but let’s start this on the second line, third character location, or (1,2).  The entire program is then:
#include <Zumo32U4.h>
Zumo32U4LCD lcd;
void setup() {
  lcd.clear();
  lcd.gotoXY(0,0);
  lcd.print("Hello");
  lcd.gotoXY(1,2);
  lcd.print("World");
}

void loop() {
  // put your main code here, to run repeatedly:
}

 

This entry was posted in Robotics and tagged , . Bookmark the permalink.

2 Responses to Zumo 32U4 Simple LCD Display Test

  1. sandra jaramillo says:

    a question there are four infrared leds
    – Two black and two transparent, one of narrow coverage and others not so narrow.
    which go to the front of the zumo transparent or black?

    • Andrew Brown says:

      Sandra, you can put either on the front. The version of the kit that has the end user build the kit ships with both narrow and wide beam LEDs allowing you to select more narrow coverage, but about 20-30% longer range, or wider coverage with shorter range. We ended up going with the longer range, and sweep the robot side-to-side to get the coverage. The Zumo also has surface mount, side looking LED’s with extremely wide beam patterns. We ended up desoldering the side looking LEDs, and replacing those with narrow beam as well.

      Hope this helps. If you have any other questions, feel free to ask.

Leave a Reply

Your email address will not be published. Required fields are marked *