Hello, I was hoping someone could give me some help in regard to the program I am writing. I am getting the following errors:
\arduino-1.0\libraries\menu\menu.cpp: In constructor 'menu::menu(char**)':
\menu.cpp:11: error: incompatible types in assignment of 'char**' to 'String [0]' (This is not showing up properly in the post it should be' Square bracket 0 square bracket')
I am creating a library to manage all the menu lists for a 2 line LCD screen and want to pass it an array of strings which it can send back to the program the stings in focus depending on the screen pointer. I will eventually have many menus so hence the need for a class/library.
What is it about that message that you don't understand? It seems perfectly clear to me. The char type, the char pointer type, the char array type, and the String class are all different types. You can not assign an array of char pointers (MenuItems) to an array of String objects (_MenuItems).
Well I finally got it to work and thought id update this post to make it complete, just in case there is someone else out there that is confused about the pointer to array of pointer concept. So here is my code.
Thanks for you help PaulS
/*
menu.h - Library for handling LCD menus
Created by Colin Wildsmith, March, 2012.
*/
#ifndef menu_h
#define menu_h
#include "Arduino.h"
class menu
{
public:
menu(char** MenuItems);
String lcdDisplay(boolean lineCursor);
private:
char** _MenuItems;
};
#endif
/*
menu.h - Library for handling LCD menus
Created by Colin Wildsmith, March, 2012.
*/
#include "Arduino.h"
#include "menu.h"
menu::menu(char** MenuItems)
{
_MenuItems = MenuItems;
}
String menu::lcdDisplay(boolean lineCursor)
{
if (lineCursor == true) {
return _MenuItems[0];
}
else {
return _MenuItems[1];
}
}