arduino connect the library to the library



  • I'm gonna have to write my library for the Arduin for the LCD menu. I figured out how it's done to connect to the skateboard. But I need to use my methods in this library. lcd.print(") Library LiquidCrystal_I2C♪ I can't figure it out, IDE always argues that lcd is not defined.

    Help me understand how to connect the library. LiquidCrystal_I2C

    test.ino

    #include <LcdMenu.h>
    

    LcdMenu menu(5);

    void setup()
    {
    menu.print_menu_buffer(5);
    }

    void loop()
    {
    }

    LcdMenu.cpp

    #include "Arduino.h"
    #include "LcdMenu.h"

    LcdMenu::LcdMenu(int say_hi)
    {
    _say_hi = say_hi;

    };

    void LcdMenu::print_menu_buffer(int menu_pos)
    {
    menu_position = menu_pos;
    //lcd.clear();
    //lcd.setCursor(0, 0);
    //lcd.print(menu_buffer1 [menu_pos]);
    } ;

    LcdMenu.h

    // ensure this library description is only included once
    #ifndef LcdMenu_h
    #define LcdMenu_h

    #include "Arduino.h"

    // library interface description
    class LcdMenu {
    public:
    // constructors:
    LcdMenu(int say_hi);
    void print_menu_buffer(int menu_pos);
    void set_menu_buffer(int menu_pos, char top_line, char bottom_line);
    void get_menu_buffer(int menu_pos);

    private:

    int _say_hi;
    int x; 
    char menu_buffer1 [1]; //{ { "top line", "bottom line" }
    char menu_buffer2 [1];
    char menu_buffer3 [1];
    char menu_buffer4 [1];
    char menu_buffer5 [1];
    char menu_buffer6 [1];
    char menu_buffer7 [1];
    char menu_buffer8 [1];
    char menu_buffer9 [1];
    char menu_buffer10 [1];
    char menu_buffer11 [1];
    char menu_buffer12 [1];
    char menu_buffer13 [1]; 
    
    int menu_position;
    

    };

    #endif



  • The Arduino Library cannot serve as another library. This is the requirement for libraries - their code must be self-sufficient.

    The thing is, the skate code in the compilation is copied into the time folder, and the library code is being copied with it. There is no way to inform Arduino IDE that the library uses another library.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2