Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.

How to print data from serial port to LCD on a Arduino

0 votes

Hello everyone,

I would like to know how to print data from the serial port sent by a JeVois and received by an Arduino MEGA 2560 to an LCD that is connected to the same Arduino.

I am using the ArUco module on my JeVois and I would like to use ArUco tags to guide a robot. To do so, I was able to send the output that my JeVois shows when it detects a tag (in serstyle Normal) through the 4-pin to an Arduino MEGA 2560 and I was able to read in the serial monitor, with success, messages in this format : N2 id x y w h

The code used to receive the messages is not perfect, it needs some tweaks but for now it does the job.

Now, I would like to print the data from the serial monitor to an LCD that is connected to the Arduino but I don't know how to proceed (I am not very familiar with the Arduino and the LCD)

Thank you in advance for any useful links and responses related to my question

asked Apr 20, 2019 in Programmer Questions by M0 (150 points)

1 Answer

+1 vote

That is more of an Arduino question, and it depends on what kind of LCD you are using.

From the vendor of your LCD, or from Arduino docs, you should get some info about which pins to connect the display to, and then which Arduino libraries to use to access it and write messages to it.

Here is an example where we connected a 0.96" graphic OLED display using an SPI interface to an Arduino Pro Micro. Just look for "0.96 SPI OLED" to find that display, many vendors have it (beware that many include the keyword SPI even though they are selling an I2C version).

The goal was to have a self-contained "dice counting flashlight", using the dice counting algo of:

http://jevois.org/tutorials/ProgrammerPythonDice.html

- First you load required libraries:

#include <SPI.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <gfxfont.h>
 

- Then init the display

// Use hardware SPI for OLED:
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

and, in setup():

  // Init OLED display:
  display.begin(SSD1306_SWITCHCAPVCC);
  display.clearDisplay();
  display.display();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("JeVois ");
  display.setTextSize(1);
  display.setCursor(94, 0);
  display.print("DICE");
  display.setCursor(85, 9);
  display.print("COUNTER");
  display.setTextSize(6);
  display.setCursor(20, 16);
  display.print(0);

  display.display();

- then you use it to display stuff in loop():

  // Display pips:
  int pips=12; // replace by what jevois reported
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setCursor(0,20);
  display.print(pips);
  display.display();

answered Apr 22, 2019 by JeVois (46,580 points)
It is an 16x2 LCD, part of a kit bought from Elegoo, which is from Qapass and the model of the LCD module is 1602A.

I have no problem with the connections, my LCD correctly wired to my Arduino Mega, the code provided by Elegoo (which is a basic Hello World !) works perfectly. I am using the LiquidCrystal library.

Like you said at the beginning it's more of an Arduino question, I would like to print the data that I received from my JeVois to the LCD that is connected to my Arduino.

Thank you for your help.

**UPDATE** : I found a way to do it, it works like I want. Again, thank you very much for your response !
...