Solved "Void value not ignored as it ought to be"

Hello

I am just starting to write my own library to run an user interface with a LCD shield (HD44780 LCD + 5 key analog keyboard).

This library should have functions like menus that allows the user to select an option or to set a value etc...

The library has only one class called UI. I started yesterday and wrote only one function called "pause" This function takes three arguments: two char arrays (one for the top and bottom lines) and an int which is a delay. I did also wrote a demo sketch that should print something using that function then cler the screen after 3 seconds.

Here is the code:

Demo sketch:

#include"ui.h"//Include the UI library
#include<LiquidCrystal.h>

void setup()
{
  LiquidCrystal lcd(8,9,4,5,6,7);//Create lcd instance
  UI ui(lcd);//Create a new instance of the UI object
  ui.pause("Haut", "Bas", 3);//Print something and wait for 3 seconds
  lcd.clear();//Clear the lcd
}

void loop()
{
  
}

Header file

#ifndef DEF_UI
#define DEF_UI

#include <LiquidCrystal.h>

using namespace std;

class UI
{
  public :
  UI(LiquidCrystal lcd);//Constructor
  void pause(char up [], char down [], int pause);
  ~UI();//Destructor
  private:
  LiquidCrystal *m_lcd = 0;//Pointer to a LiquidCrystal object
};

#endif

Cpp file

#include "ui.h"

UI::UI(LiquidCrystal lcd)
{
  m_lcd = new LiquidCrystal(lcd);//The pointer is initialized with the address of the new LiquidCrystal object.
}

void UI::pause(char up [], char down [], int pause)
{
  *m_lcd->clear();//Clear the lcd
  *m_lcd->print(up);//Print the uppper line
  *m_lcd->setCursor(0, 1);//Set cursor to bottom line
  *m_lcd->print(down);//Print the bottom line
  delay(pause);//Wait xx milliseconds
}

UI::~UI()
{
  delete m_lcd;//Delete the LCD
}

I get the follwoing error:

void value not ignored as it ought to be

at this line

*m_lcd->setCursor(0, 1);//Set cursor to bottom line

If I commment this line I get the error at

*m_lcd->clear();//Clear the lcd

I know that this error occurs when you try to get a value from a void function. Example:

void function (argument)
{
  //some code
}

variable = function(argument);

I don't understand why I get this error. I don't see where would I not ignore the void value
Any help would be greatly appreciated. I'm sure there is a stupid mistake somewhere in the code...

Your UI constructor is gruesome crap and its comment wrong.

UI::UI(LiquidCrystal lcd)
{
  m_lcd = new LiquidCrystal(lcd);//The pointer is initialized with the address of the new LiquidCrystal object.
}

I would use something like

UI::UI(LiquidCrystal lcd) : m_lcd(lcd) {}

What do you think the '*' in the error lines should do?

  *m_lcd->clear();//Clear the lcd
  *m_lcd->print(up);//Print the uppper line
  *m_lcd->setCursor(0, 1);//Set cursor to bottom line
  *m_lcd->print(down);//Print the bottom line

Have you ever used pointers before?