[SOLVED] LCD print problem with MAX CHIP

Hi folks,

Im using the GPOUT pins on the MAX3421E of the USB host shield from the sparkfun and connected the pins like >> pinout: D[4-7] -> GPOUT[4-7], RS-> GPOUT[2], E ->GPOUT[3] but im getting errors which are not resolving by me here the link to library >> USB_Host_Shield/Max_LCD.h at master · felis/USB_Host_Shield · GitHub , the following is my programme with the errors:

The code:

#include <avr/pgmspace.h>

#include <avrpins.h>
#include <max3421e.h>
#include <usbhost.h>
#include <usb_ch9.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <address.h>
#include <hid.h>
#include <hiduniversal.h>
#include "max_LCD.h"
#include "hidjoystickrptparser.h"

#include <printhex.h>
#include <message.h>
#include <hexdump.h>
#include <parsetools.h>
//#include <LiquidCrystal.h>
//LiquidCrystal lcd(6,15,5,4,3,2);

USB                                             Usb;
USBHub                                          Hub(&Usb);
HIDUniversal                                    Hid(&Usb);
JoystickEvents                                  JoyEvents;
JoystickReportParser                            Joy(&JoyEvents);

 max_LCD LCD;

void setup()
{
  pinMode(A5, OUTPUT);
  pinMode(A1, INPUT);
  digitalWrite(A5, HIGH);
  Serial.begin(9600);
  Serial.println("Start");
  //lcd.print("Start");
  LCD.begin(20, 4);
  LCD.home();
  LCD.write("keys");

  if (Usb.Init() == -1) {
      //lcd.print(" - OSC did not Start");
      Serial.println("OSC did not start.");
  } else {Serial.print("Ready!");}
  delay( 200 );

  if (!Hid.SetReportParser(0, &Joy))
      ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1  ); 
}

void loop()
{
  /*
  while(Serial.available()){  //is there anything to read?
	char getData = Serial.read();  //if yes, read it

	if(getData == 'a'){
  	  digitalWrite(A4, HIGH);
          lcd.print('a');
	}else if(getData == 'b'){
  	  digitalWrite(A4, LOW);
          lcd.print('b');
	}
  }*/
    Usb.Task();
}

The following are the errors im getting:

MasterController:29: error: 'max_LCD' does not name a type
MasterController.cpp: In function 'void setup()':
MasterController:39: error: 'LCD' was not declared in this scope

Where in that header file is mac_LCD defined? Max_LCD IS defined. CASE MATTERS!

Yes the case matters Mr.Paul i have tried with both but the same ERRORS pop up also in the new library the Max_LCD.h name is not max_LCD.h and also tried the small case library name with Max_LCD LCD; to define a LCD object but that doesnot seem to work

In that file:

class Max_LCD : public Print {

It is not max_LCD.

You have:

 max_LCD LCD;

You have to get this stuff right.

Thanks sir , I tried as you said but still the problem is there, after in about 30mins I post what the errors are with it.

This is what i get as errors with #include <max_LCD.h> as header file and Max_LCD LCD; as the object for LCD

MasterController:29: error: no matching function for call to 'Max_LCD::Max_LCD()'
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.h:71: note: candidates are: Max_LCD::Max_LCD(USB*)
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.h:67: note:                 Max_LCD::Max_LCD(const Max_LCD&)

EDIT: does these errors mean i need to put the object wanted to be created as Max_LCD(LCD);

In the USB host shield 2.0 version here (attached the library) some things have changed like the Max_LCD.h is now max_LCD.h and likewise however i checked inside them they seem to be as same.

felis-USB_Host_Shield_2.0-baf94b6.zip (180 KB)

Lowered the Errors atleast NOW IT SHOWS ONLY ONE ERROR with the latest library of USB-HostShiedl_2.0 it goes like

error:

MasterController:29: error: 'max_LCD' does not name a type

Im using the header as #include <max_LCD.h> and object creation as >> max_LCD LCD; , IM TOO CLOSE TO SOLVE IT NOW!

The class name (not the include filename) is "Max_LCD".

You should be using:

Max_LCD LCD;

@ majenko by using that i get the following SAME errors:

MasterController:29: error: no matching function for call to 'Max_LCD::Max_LCD()'
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.h:71: note: candidates are: Max_LCD::Max_LCD(USB*)
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.h:67: note:                 Max_LCD::Max_LCD(const Max_LCD&)

so it is not helping me to make it work till now.

That is saying that you have to either create the LCD object by passing it a USB structure, or an existing LCD object.

Try:

Max_LCD LCD(Usb);

It worked! but with an "&" in there like Max_LCD LCD(&Usb); thanks for it

further i checked using the LCD.print("anything");
it is not working it says :

MasterController.cpp: In function 'void setup()':
MasterController:41: error: 'class Max_LCD' has no member named 'print'

then i checked the max_LCD.h library and saw there is nothing like print or write in there.
So how im going to print on LCD?

EDIT: write is there but it accepts unit8 int and as such i cant load the string into it.

UPDATE: i got ERROR when i inserted this

LCD.begin(20, 4);
  LCD.home();

and the ERRORS are:

usb\max_LCD.cpp.o: In function `Max_LCD':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:52: multiple definition of `Max_LCD::Max_LCD(USB*)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:52: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:52: multiple definition of `Max_LCD::Max_LCD(USB*)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:52: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::sendbyte(unsigned char)':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:233: multiple definition of `Max_LCD::sendbyte(unsigned char)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:233: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::createChar(unsigned char, unsigned char*)':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:214: multiple definition of `Max_LCD::createChar(unsigned char, unsigned char*)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:214: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::noAutoscroll()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:207: multiple definition of `Max_LCD::noAutoscroll()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:207: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::autoscroll()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:201: multiple definition of `Max_LCD::autoscroll()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:201: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::rightToLeft()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:195: multiple definition of `Max_LCD::rightToLeft()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:195: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::leftToRight()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:189: multiple definition of `Max_LCD::leftToRight()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:189: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::scrollDisplayRight()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:185: multiple definition of `Max_LCD::scrollDisplayRight()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:185: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::scrollDisplayLeft()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:182: multiple definition of `Max_LCD::scrollDisplayLeft()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:182: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::blink()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:175: multiple definition of `Max_LCD::blink()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:175: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::noBlink()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:171: multiple definition of `Max_LCD::noBlink()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:171: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::cursor()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:164: multiple definition of `Max_LCD::cursor()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:164: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::noCursor()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:160: multiple definition of `Max_LCD::noCursor()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:160: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::display()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:154: multiple definition of `Max_LCD::display()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:154: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::noDisplay()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:150: multiple definition of `Max_LCD::noDisplay()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:150: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::setCursor(unsigned char, unsigned char)':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:139: multiple definition of `Max_LCD::setCursor(unsigned char, unsigned char)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:139: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::home()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:135: multiple definition of `Max_LCD::home()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:135: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::clear()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:129: multiple definition of `Max_LCD::clear()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:129: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::begin(unsigned char, unsigned char, unsigned char)':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:67: multiple definition of `Max_LCD::begin(unsigned char, unsigned char, unsigned char)'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:67: first defined here
usb\max_LCD.cpp.o: In function `Max_LCD::init()':
C:\Users\nishant\Downloads\arduino-0022\libraries\usb/max_LCD.cpp:58: multiple definition of `Max_LCD::init()'
max_LCD.cpp.o:C:\Users\nishant\AppData\Local\Temp\build1427935164216084090.tmp/max_LCD.cpp:58: first defined here

uint8_t is the same as a single character. You will need to iterate over the contents of a string and write each individual character.

Hi Majenko i loaded an UPDATE in the above post please see

EDIT:UPDATE LATEST
HI MAJENKO

I did that compling fine NOW ITS ALL WORKING, BUT STILL i need to do that iterating thing to print things on LCD.

what if i change the data type in the Max_LCD.h and Max_LCD.cpp to String or something i want , i think it must work?!

But the question is ,it is some reason that uint8_t has been used.

I wrote a small function that works pretty fine with printing all the statements, Now its all done very well.