Suggerimenti libreria per menu su LCD20x4

salve a tutti,

credo che a tutti sia capitato di dover inserire/modificare le variabili del proprio sketch e venendo da linguaggi tipo "pascal" ho trovato molto familiare il metodo appreso qui

che andava piu che bene nonostante l'uso "sconsigliabile" del sprinf e fin quando si trattava di gestire un rtc.

ora che il mio progettino comincia a ingrandirsi (30 variabili, quindi 30 if (...=...))mi rendo conto che questo metodo non va piu bene: oltre a rendere il listato veramente lungo, è pieno di ripetizioni che ,di fatto, occupano piu della meta dello spazio per i programmi(93%)

ho provato a guardare qualche libreria gia fatta ma essendo molto inesperto di "C" ho preferito fermarmi e chiedere a qualche esperto un consiglio su una libreria leggera per lcd20x4

per ora volevo provare qualcosa del tipo

String menu[] = {MENU1,MENU2,MEN3,ECC ECC};
float  val[] ={temp,umid,press,ist,cali,ecc ecc};
per poi creare un void printmenu(){
if menupag = 1
lcd.print(menu[1]);
....
lcd print(val[1]);

ma prima volevo saper se era un metodo"valido" di procedere

Qui ce ne sono un po'
https://github.com/search?q=Arduino_LCD_Menu
ma non ne ho usata mai neanche una. Puoi vedere gli esempi.

>mixmax122: Ci sarebbe la NON più supportata (dall'autore, che non si è più visto sul forum) libreria MENWIZ che trovi in area megatopic ...
... leggi l'ultimo post per avere una versione (la 1.3.2) che si può utilzzare con l'ultimo IDE (1.8.9).

Attenzione, richiede o un Arduno MEGA o altra scheda (es. QUESTA) che comunque abbia più di 2KB di SRAM.

Vedi tu ... ::slight_smile:

Guglielmo

Quindi per lui non va bene, ne cercava una che occuppasse poca memoria!

L'autore Brunialti però sembra attivo su GitHub (Feb 2019) con un unico repository che non riguarda Arduino, almeno sembra.

anzitutto grazie a entrambi per la risposta

@gpb01 avevo gia provato menwiz, ma è pesantuccia.... piuttosto, davvero caruccia quella schedina... sembra una sorta di MEGA miniaturizzata...

@zoomx avevo cominciato a guardare LCDmunulib e LCDmenulib2 sembrano davvero complete e integrano la tastiera analogica... pero mi sa che virero su "liquidmenu": di primo acchito sembra proprio quello che cerco: leggera e semplice, anche se per 16x02 e prevede la class button con tasti digitali... intanto comincio a studiarla un po per vedere se riesco a farle digerire i tasti analogici....

mixmax122:
@gpb01 avevo gia provato menwiz, ma è pesantuccia.... piuttosto, davvero caruccia quella schedina... sembra una sorta di MEGA miniaturizzata...

In pratica lo è :slight_smile: ... da li il nome midi che nulla a a che vedere con lo standard usato per gli strumenti musicali, ma indica una via di mezzo tra le varie mini, micro, e mega :smiley: :smiley: :smiley:

Considera che rispetto ad una mega, ha si meno flash per il codice (128K rispetto ai 256K), ma ha il doppio di SRAM (16K contro gli 8K della mega) ... tanto che ci girano piuttosto bene applicazioni con il sistema operativo FreeRTOS™ ! :slight_smile:

Guglielmo

Per i tasti analogici potresti prendere il codice dalla libreria dfrobot per lo shield con LCD16x2 e tasti analogici.
Praticamente questo, che è proprio l'esempio per i tasti:

//http://www.dfrobot.com/wiki/index.php/Arduino_LCD_KeyPad_Shield_%28SKU:_DFR0009%29

// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

// read the buttons
int read_LCD_buttons()
{
  adc_key_in = analogRead(0);      // read the value from the sensor
  // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
  // we add approx 50 to those values and check to see if we are close
  if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result

  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 195)  return btnUP;
  if (adc_key_in < 380)  return btnDOWN;
  if (adc_key_in < 555)  return btnLEFT;
  if (adc_key_in < 790)  return btnSELECT;
  return btnNONE;  // when all others fail, return this...
}

void setup()
{
  Serial.begin(9600);
  Serial.println("LCDkeypadTestButtons2 only buttons");
  Serial.print("Push the buttons"); // print a simple message
}

void loop() {
  Serial.print(analogRead(0));
  Serial.print("   ");
  Serial.print(analogRead(1));
  Serial.print("   ");
  Serial.print(analogRead(2));
  Serial.print("   ");
  Serial.print(analogRead(3));
  Serial.print("   ");
  Serial.print(analogRead(4));
  Serial.print("   ");
  Serial.print(analogRead(5));
  Serial.print("   ");
  switch (lcd_key) {              // depending on which button was pushed, we perform an action

    case btnRIGHT: {            //  push button "RIGHT" and show the word on the screen
        Serial.println("RIGHT ");
        break;
      }
    case btnLEFT: {
        Serial.println("LEFT");
        break;
      }
    case btnUP: {
        Serial.println("UP");
        break;
      }
    case btnDOWN: {
        Serial.println("DOWN");
        break;
      }
    case btnSELECT: {
        Serial.println("SELECT");
        break;
      }
    case btnNONE: {
        Serial.println("NONE");
        break;
      }
  }
}

ovviamente io avevo pensato allo strumento musicale, che testone !!! :slight_smile:

comunque per modificare la lettura dei tasti in liquid menu da digitale a analogica ho scritto:

#pragma once



class Button {
public:
  Button( uint16_t valmax, uint16_t valmin, uint16_t debounceDelay = 50
      : _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),
      _lastDebounceTime(0)


bool check(bool triggerState = LOW) {
    uint16_t val = analogRead(A0);
    // Checks if the buttons has changed state
 if (val > valmin && val < valmax)
        bool reading = HIGH;
    if (reading != _lastState) {
      _lastDebounceTime = millis();
    }
    // Checks if the buttons hasn't changed state for '_debounceDelay' milliseconds.
    if ((millis() - _lastDebounceTime) > _debounceDelay) {
      // Checks if the buttons has changed state
      if (reading != _state) {
        _state = reading;
        return _state;
      }
    }
    _lastState = reading;
    // If this code is reached, it returns the normal state of the button.
    if (triggerState == HIGH) {
      return LOW;
    } else {
      return HIGH;
    }
  }

private:

  bool _state;
  bool _lastState;
  uint32_t _lastMillis;
  uint16_t _debounceDelay;
  uint32_t _lastDebounceTime;
};

che dite lo carico? o esplode tutto ? :slight_smile:
ovviamente scherzo ma puo a servire anche a qualcun'altro.......

che ovviamente non funziona

#pragma once
class Button {
private:

  bool _state;
  bool _lastState;
  uint32_t _lastMillis;
  uint16_t _debounceDelay;
  uint32_t _lastDebounceTime;
  
public:
  Button( uint16_t valmax, uint16_t valmin, uint16_t debounceDelay = 50
      : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),
      _lastDebounceTime(0){
        
      }


bool check(bool triggerState = LOW) {
    uint16_t val = analogRead(A0);
    // Checks if the buttons has changed state
 if (val > valmin && val < valmax){
        bool reading = HIGH;}
    if (reading != _lastState) {
      _lastDebounceTime = millis();
    }
    // Checks if the buttons hasn't changed state for '_debounceDelay' milliseconds.
    if ((millis() - _lastDebounceTime) > _debounceDelay) {
      // Checks if the buttons has changed state
      if (reading != _state) {
        _state = reading;
        return _state;
      }
    }
    _lastState = reading;
    // If this code is reached, it returns the normal state of the button.
    if (triggerState == HIGH) {
      return LOW;
    } else {
      return HIGH;
    }
  }


};
Arduino:1.8.9 (Windows Store 1.8.21.0) (Windows 10), Scheda:"Arduino/Genuino Uno"

In file included from C:\Users\mixma\Documents\Arduino\D_buttons_menu\D_buttons_menu.ino:52:0:

C:\Users\mixma\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:59:102: note: #pragma message: LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it.

 #pragma message ("LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it.")

                                                                                                      ^

In file included from C:\Users\mixma\Documents\Arduino\D_buttons_menu\D_buttons_menu.ino:53:0:

Button.h:15:22: error: '_lastState' is not a type

       : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),

                      ^

In file included from sketch\D_buttons_menu.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected ')' before numeric constant

 #define LOW  0x0

              ^

sketch\Button.h:15:33: note: in expansion of macro 'LOW'

       : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),

                                 ^

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected ')' before numeric constant

 #define LOW  0x0

              ^

sketch\Button.h:15:33: note: in expansion of macro 'LOW'

       : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),

                                 ^

In file included from C:\Users\mixma\Documents\Arduino\D_buttons_menu\D_buttons_menu.ino:53:0:

Button.h:15:32: error: expected ';' at end of member declaration

       : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),

                                ^

In file included from sketch\D_buttons_menu.ino.cpp:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^

sketch\Button.h:15:33: note: in expansion of macro 'LOW'

       : _state(LOW), _lastState(LOW), _lastMillis(0), _debounceDelay(debounceDelay),

                                 ^

In file included from C:\Users\mixma\Documents\Arduino\D_buttons_menu\D_buttons_menu.ino:53:0:

sketch\Button.h: In member function 'bool Button::check(bool)':

Button.h:24:12: error: 'valmin' was not declared in this scope

  if (val > valmin && val < valmax){

            ^

Button.h:24:28: error: 'valmax' was not declared in this scope

  if (val > valmin && val < valmax){

                            ^

Button.h:26:9: error: 'reading' was not declared in this scope

     if (reading != _lastState) {

         ^

Button.h:32:11: error: 'reading' was not declared in this scope

       if (reading != _state) {

           ^

Button.h:37:18: error: 'reading' was not declared in this scope

     _lastState = reading;

                  ^

exit status 1
'_lastState' is not a type

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"

salve a tutti dopo un paio di giorni di inattivita forzata( un hd partito e un molare che è impazzito).
ho provato a giocare cn quella libreria ma ancora non riesco a farla funzionare

#include <Wire.h>
#include <LiquidMenu.h>
#include <LiquidCrystal_I2C.h>
 LiquidCrystal_I2C lcd(0x27, 20, 4);


union ambienta{
  struct{
  float Temp  ;
  float Umid  ;
  float _Ph  ;
  float _Ec  ;
  float _Th2o; 
  } Amb ;
  byte arr[20];
} Ambientale;


byte leggitast(){

   int val = (analogRead(A0));


if (val < 100) {
             return 0;}
    if ( (val > 810)  && (val <850)  )  //841
                 {
                 return 1 ;
                 }
      if ( (val > 315)  && (val <360 ))  //333-4
                 { return 2 ;
                 } 
       if ( (val >580)  && (val < 625) ) ///617
                 {  return 3 ;
                 } 
     if ( val > 710  && val < 760 )  //745
                 { return 4 ;
                 }             
     if ( (val > 180)  && (val < 190)  )    //184-185
                 { return 5 ;
                 }


   
}


void WaitBtnRelease()
{
    while( analogRead(A0) > 100){ }
}

// Checks all the buttons.
void buttonsCheck() {
  if (leggitast() == 3) {
    venu.next_screen();
    WaitBtnRelease();
  }
  if (leggitast() == 4) {
    venu.previous_screen();
  }
  if (leggitast() == 1) {
    // Calls the function identified with
    // increase or 1 for the focused line.
    venu.call_function(2);
  }
  if (leggitast() == 2) {
    venu.call_function();
  }
  if (leggitast() == 5) {
    // Switches focus to the next line.
  //  venu.switch_focus();
  }
}


const byte startingScreen = 1;


LiquidLine men1(1, 0, "Temp   : ", Ambientale.Amb.Temp );
LiquidLine men2(1, 0, "Umid   : ", Ambientale.Amb.Umid);
LiquidLine men3(1, 0, "PH     : ", Ambientale.Amb._Ph);
LiquidLine men4(1, 0, "Temp   : ", Ambientale.Amb._Ec);
LiquidScreen enu(men1,men2,men3,men4);

LiquidMenu venu(lcd, startingScreen);

void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);

  pinMode(led, OUTPUT);
  lcd.init();
   lcd.backlight(); 
   venu.init();

  men1.attach_function(1, blink_switch);
   men1.attach_function(2, blink_switch);
  venu.add_screen(enu);
  venu.update();

  
}

void loop() {
  // put your main code here, to run repeatedly:
buttonsCheck();

}

che genera

Arduino:1.8.9 (Windows Store 1.8.21.0) (Windows 10), Scheda:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino:3:0:

C:\Users\mixma\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:55:97: note: #pragma message: LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it.

 #pragma message ("LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it.")

                                                                                                 ^

C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino: In function 'void buttonsCheck()':

sketch_jun07a:57:5: error: 'venu' was not declared in this scope

     venu.next_screen();

     ^

sketch_jun07a:61:5: error: 'venu' was not declared in this scope

     venu.previous_screen();

     ^

sketch_jun07a:66:5: error: 'venu' was not declared in this scope

     venu.call_function(2);

     ^

sketch_jun07a:69:5: error: 'venu' was not declared in this scope

     venu.call_function();

     ^

C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino: In function 'void setup()':

sketch_jun07a:93:11: error: 'led' was not declared in this scope

   pinMode(led, OUTPUT);

           ^

sketch_jun07a:98:27: error: 'blink_switch' was not declared in this scope

   men1.attach_function(1, blink_switch);

                           ^

exit status 1
'venu' was not declared in this scope

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"

qualcuno mi sa dire dove sbaglio???

Intanto sopetto che tu abbia scritto venu al posto di menu
Poi credo manchi qualcosa come

LiquidMenu menu(lcd);

credo di aver corretto ma :confused:

#include <Wire.h>
#include <LiquidMenu.h>
#include <LiquidCrystal_I2C.h>
 LiquidCrystal_I2C lcd(0x27, 20, 4);


union ambienta{
  struct{
  float Temp  ;
  float Umid  ;
  float _Ph  ;
  float _Ec  ;
  float _Th2o; 
  } Amb ;
  byte arr[20];
} Ambientale;


byte leggitast(){

   int val = (analogRead(A0));


if (val < 100) {
             return 0;}
    if ( (val > 810)  && (val <850)  )  //841
                 {
                 return 1 ;
                 }
      if ( (val > 315)  && (val <360 ))  //333-4
                 { return 2 ;
                 } 
       if ( (val >580)  && (val < 625) ) ///617
                 {  return 3 ;
                 } 
     if ( val > 710  && val < 760 )  //745
                 { return 4 ;
                 }             
     if ( (val > 180)  && (val < 190)  )    //184-185
                 { return 5 ;
                 }


   
}


void WaitBtnRelease()
{
    while( analogRead(A0) > 100){ }
}

// Checks all the buttons.
void buttonsCheck() {
  if (leggitast() == 3) {
    Menu.next_screen();
    WaitBtnRelease();
  }
  if (leggitast() == 4) {
    Menu.previous_screen();
  }
  if (leggitast() == 1) {
    // Calls the function identified with
    // increase or 1 for the focused line.
    Menu.call_function(2);
  }
  if (leggitast() == 2) {
    Menu.call_function(1);
  }
  if (leggitast() == 5) {
    // Switches focus to the next line.
  //  venu.switch_focus();
  }
}


const byte startingScreen = 1;


LiquidLine param1(1, 0, "Temp   : ", Ambientale.Amb.Temp );
LiquidLine param2(1, 0, "Umid   : ", Ambientale.Amb.Umid);
LiquidLine param3(1, 0, "PH     : ", Ambientale.Amb._Ph);
LiquidLine param4(1, 0, "Temp   : ", Ambientale.Amb._Ec);
LiquidScreen scherm1(param1,param2,param3,param4);



LiquidMenu Menu(lcd);




void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);

  pinMode(led, OUTPUT);
  lcd.init();
   lcd.backlight(); 
   Menu.init();

 // men1.attach_function(1, blink_switch);
 //  men1.attach_function(2, blink_switch);
  Menu.add_screen(scherm1);
  Menu.update();

  
}

void loop() {
  // put your main code here, to run repeatedly:
buttonsCheck();

}

float Ambientale.Amb._Tg (){
  
}
Arduino:1.8.9 (Windows Store 1.8.21.0) (Windows 10), Scheda:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino:3:0:

C:\Users\mixma\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:55:97: note: #pragma message: LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it.

 #pragma message ("LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it.")

                                                                                                 ^

C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino: In function 'void buttonsCheck()':

sketch_jun07a:57:5: error: 'Menu' was not declared in this scope

     Menu.next_screen();

     ^

sketch_jun07a:61:5: error: 'Menu' was not declared in this scope

     Menu.previous_screen();

     ^

sketch_jun07a:66:5: error: 'Menu' was not declared in this scope

     Menu.call_function(2);

     ^

sketch_jun07a:69:5: error: 'Menu' was not declared in this scope

     Menu.call_function(1);

     ^

C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino: In function 'void setup()':

sketch_jun07a:93:11: error: 'led' was not declared in this scope

   pinMode(led, OUTPUT);

           ^

C:\Users\mixma\Documents\Arduino\sketch_jun07a\sketch_jun07a.ino: At global scope:

sketch_jun07a:112:17: error: expected initializer before '.' token

 float Ambientale.Amb._Tg (){

                 ^

exit status 1
'Menu' was not declared in this scope

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"
#include <Wire.h>
#include "LiquidMenu.h"
#include "LiquidCrystal_I2C.h"
LiquidCrystal_I2C lcd(0x27, 20, 4);

LiquidMenu menu(lcd);

const byte led = 13;

union ambienta {
  struct {
    float Temp  ;
    float Umid  ;
    float _Ph  ;
    float _Ec  ;
    float _Th2o;
  } Amb ;
  byte arr[20];
} Ambientale;



const byte startingScreen = 1;


LiquidLine param1(1, 0, "Temp   : ", Ambientale.Amb.Temp );
LiquidLine param2(1, 0, "Umid   : ", Ambientale.Amb.Umid);
LiquidLine param3(1, 0, "PH     : ", Ambientale.Amb._Ph);
LiquidLine param4(1, 0, "Temp   : ", Ambientale.Amb._Ec);
LiquidScreen scherm1(param1, param2, param3, param4);







byte leggitast() {

  int val = (analogRead(A0));


  if (val < 100) {
    return 0;
  }
  if ( (val > 810)  && (val < 850)  ) //841
  {
    return 1 ;
  }
  if ( (val > 315)  && (val < 360 )) //333-4
  { return 2 ;
  }
  if ( (val > 580)  && (val < 625) ) ///617
  { return 3 ;
  }
  if ( val > 710  && val < 760 )  //745
  { return 4 ;
  }
  if ( (val > 180)  && (val < 190)  )    //184-185
  { return 5 ;
  }



}


void WaitBtnRelease()
{
  while ( analogRead(A0) > 100) { }
}

// Checks all the buttons.
void buttonsCheck() {
  if (leggitast() == 3) {
    menu.next_screen();
    WaitBtnRelease();
  }
  if (leggitast() == 4) {
    menu.previous_screen();
  }
  if (leggitast() == 1) {
    // Calls the function identified with
    // increase or 1 for the focused line.
    menu.call_function(2);
  }
  if (leggitast() == 2) {
    menu.call_function(1);
  }
  if (leggitast() == 5) {
    // Switches focus to the next line.
    //  venu.switch_focus();
  }
}





void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(led, OUTPUT);
  lcd.begin();
  //lcd.init();
  lcd.backlight();
  menu.init();

  // men1.attach_function(1, blink_switch);
  //  men1.attach_function(2, blink_switch);
  menu.add_screen(scherm1);
  menu.update();


}

void loop() {
  // put your main code here, to run repeatedly:
  buttonsCheck();

}
/*
float Ambientale.Amb._Tg () {

}
*/

menu l'ho messo piccolo e la dichiarazione l'ho spostata in alto così come altre cose.
Inoltre ho commentato

float Ambientale.Amb._Tg

perché non ci possono essere punti nei nomi di funzione

buondi scusate il ritardo... (cit...) :slight_smile:
ho cambiato entrambi gli hdd di questa macchina e ci ho messo un po :confused:

ho provato a compilare l' esempio da te coretto ma dà

Arduino:1.8.9 (Windows Store 1.8.21.0) (Windows 10), Scheda:"Arduino/Genuino Uno"

In file included from C:\Users\crist\Documents\Arduino\menu\menu.ino:4:0:

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:59:102: note: #pragma message: LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it.

 #pragma message ("LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it.")

                                                                                                      ^

menu:8:20: error: no matching function for call to 'LiquidMenu::LiquidMenu(LiquidCrystal_I2C&)'

 LiquidMenu menu(lcd);

                    ^

In file included from C:\Users\crist\Documents\Arduino\menu\menu.ino:4:0:

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:784:3: note: candidate: LiquidMenu::LiquidMenu(LiquidCrystal&, LiquidScreen&, LiquidScreen&, LiquidScreen&, LiquidScreen&, uint8_t)

   LiquidMenu(DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1,

   ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:784:3: note:   candidate expects 6 arguments, 1 provided

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:770:3: note: candidate: LiquidMenu::LiquidMenu(LiquidCrystal&, LiquidScreen&, LiquidScreen&, LiquidScreen&, uint8_t)

   LiquidMenu(DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1,

   ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:770:3: note:   candidate expects 5 arguments, 1 provided

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:758:3: note: candidate: LiquidMenu::LiquidMenu(LiquidCrystal&, LiquidScreen&, LiquidScreen&, uint8_t)

   LiquidMenu(DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1,

   ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:758:3: note:   candidate expects 4 arguments, 1 provided

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:747:3: note: candidate: LiquidMenu::LiquidMenu(LiquidCrystal&, LiquidScreen&, uint8_t)

   LiquidMenu(DisplayClass &liquidCrystal, LiquidScreen &liquidScreen,

   ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:747:3: note:   candidate expects 3 arguments, 1 provided

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:738:3: note: candidate: LiquidMenu::LiquidMenu(LiquidCrystal&, uint8_t)

   LiquidMenu(DisplayClass &liquidCrystal, uint8_t startingScreen = 1);

   ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:738:3: note:   no known conversion for argument 1 from 'LiquidCrystal_I2C' to 'LiquidCrystal&'

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:722:7: note: candidate: constexpr LiquidMenu::LiquidMenu(const LiquidMenu&)

 class LiquidMenu {

       ^

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:722:7: note:   no known conversion for argument 1 from 'LiquidCrystal_I2C' to 'const LiquidMenu&'

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:722:7: note: candidate: constexpr LiquidMenu::LiquidMenu(LiquidMenu&&)

C:\Users\crist\Documents\Arduino\libraries\LiquidMenu\src/LiquidMenu.h:722:7: note:   no known conversion for argument 1 from 'LiquidCrystal_I2C' to 'LiquidMenu&&'

C:\Users\crist\Documents\Arduino\menu\menu.ino: In function 'void setup()':

menu:107:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'

   lcd.begin();

             ^

In file included from C:\Users\crist\Documents\Arduino\menu\menu.ino:5:0:

C:\Users\crist\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)

   void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );

        ^

C:\Users\crist\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note:   candidate expects 3 arguments, 0 provided

exit status 1
no matching function for call to 'LiquidMenu::LiquidMenu(LiquidCrystal_I2C&)'

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"

inoltre ho corretto le 4 linee di codice che scrivevano sempre in "1, 0"

[code]


#include <Wire.h>
#include <LiquidMenu.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);

LiquidMenu menu(lcd);

const byte led = 13;

union ambienta {
  struct {
    float Temp  ;
    float Umid  ;
    float _Ph  ;
    float _Ec  ;
    float _Th2o;
  } Amb ;
  byte arr[20];
} Ambientale;



const byte startingScreen = 1;


LiquidLine param1(1, 0, "Temp   : ", Ambientale.Amb.Temp );
LiquidLine param2(1, 1, "Umid   : ", Ambientale.Amb.Umid);
LiquidLine param3(1, 2, "PH     : ", Ambientale.Amb._Ph);
LiquidLine param4(1, 3, "Temp   : ", Ambientale.Amb._Ec);
LiquidScreen scherm1(param1, param2, param3, param4);







byte leggitast() {

  int val = (analogRead(A0));


  if (val < 100) {
    return 0;
  }
  if ( (val > 810)  && (val < 850)  ) //841
  {
    return 1 ;
  }
  if ( (val > 315)  && (val < 360 )) //333-4
  { return 2 ;
  }
  if ( (val > 580)  && (val < 625) ) ///617
  { return 3 ;
  }
  if ( val > 710  && val < 760 )  //745
  { return 4 ;
  }
  if ( (val > 180)  && (val < 190)  )    //184-185
  { return 5 ;
  }



}


void WaitBtnRelease()
{
  while ( analogRead(A0) > 100) { }
}

// Checks all the buttons.
void buttonsCheck() {
  if (leggitast() == 3) {
    menu.next_screen();
    WaitBtnRelease();
  }
  if (leggitast() == 4) {
    menu.previous_screen();
  }
  if (leggitast() == 1) {
    // Calls the function identified with
    // increase or 1 for the focused line.
    menu.call_function(2);
  }
  if (leggitast() == 2) {
    menu.call_function(1);
  }
  if (leggitast() == 5) {
    // Switches focus to the next line.
    //  venu.switch_focus();
  }
}





void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(led, OUTPUT);
  lcd.begin();
  //lcd.init();
  lcd.backlight();
  menu.init();

  // men1.attach_function(1, blink_switch);
  //  men1.attach_function(2, blink_switch);
  menu.add_screen(scherm1);
  menu.update();


}

void loop() {
  // put your main code here, to run repeatedly:
  buttonsCheck();

}
/*
float Ambientale.Amb._Tg () {

}
*/

[/code]

Mi pare che in LiquidMenu_config.h ci sono da commentare alcune righe che riguardano la comunicazione parallela e decommentare quelle per la comunicazione I2C oltre alla define dove si stabilisce che la comunicazione è I2C.

Non ho qui i file in questione, però poi controllo.

zoomx:
Mi pare che in LiquidMenu_config.h ci sono da commentare alcune righe che riguardano la comunicazione parallela e decommentare quelle per la comunicazione I2C oltre alla define dove si stabilisce che la comunicazione è I2C.

Non ho qui i file in questione, però poi controllo.

veeeeeero !!! l'avevo completamente dimenticato!!!( dopo il reboot ho re installato tutte le librerie ex novo per aver l 'IDE pulito... e mi è sfuggita)

io avevo pensato a qualche incompatibilità con la liquidcristal (che uso ora) visto che on mi ricordavo quale avevo nell'altro S.O.

faccio qualche prova e vi aggiorno
intanto grazie 1000 zoomx

Queste sono le modifiche che ho fatto nel file LiquidMenu_config.h

//#define LiquidCrystal_LIBRARY (1)
#define LiquidCrystal_I2C_LIBRARY (2)
......

/*!
   @name Arduino's parallel "LiquidCrystal" library
   @{
*/
//#define LIQUIDMENU_LIBRARY LiquidCrystal_LIBRARY
//#include "LiquidCrystal.h"
//#define DisplayClass LiquidCrystal
//!@}

/*!
   @name I2C library
   @see https://github.com/johnrickman/LiquidCrystal_I2C
   @{
*/
#define LIQUIDMENU_LIBRARY LiquidCrystal_I2C_LIBRARY
#include "LiquidCrystal_I2C.h"
#define DisplayClass LiquidCrystal_I2C
//!@}

sn un po perplesso.. il mio LiquidMenu_config.h sembra essere diverso:

/**
@file
Configuration file for LiquidMenu library.

Contains global constants the configure the size of some of the arrays
used in the library, also configures the debugging messages.
*/

#pragma once

/// Switches the communication method to I2C
#define I2C false ///< @note Default: false

/// Configures the number of available variables per line.
const uint8_t MAX_VARIABLES = 5; ///< @note Default: 5

/// Configures the number of available functions per line.
const uint8_t MAX_FUNCTIONS = 8; ///< @note Default: 8

/// Configures the number of available lines per screen.
const uint8_t MAX_LINES = 12; ///< @note Default: 12

/// Configures the number of available screens per menu.
const uint8_t MAX_SCREENS = 14; ///< @note Default: 14

/// Configures the number of available menus per menus system.
const uint8_t MAX_MENUS = 8; ///< @note Default: 8

// Turns the debugging messages on or off.
#define LIQUIDMENU_DEBUG false ///< @note Default: false

ma comunque nell'esempio "I2C_liquid menu" c'è scritto che basta abilitare il "true" alle 2a linea ed il gioco è fatto (verificato, compila con un'unica modifica)

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(led, OUTPUT);
//  lcd.begin();                   !!!!!!!!!!!!!!!!
  //lcd.init();
  lcd.backlight();
  menu.init();

  // men1.attach_function(1, blink_switch);
  //  men1.attach_function(2, blink_switch);
  menu.add_screen(scherm1);
  menu.update();


}

altrimenti

[........]

exit status 1
no matching function for call to 'LiquidCrystal_I2C::begin()'

Avrò usato qualche vecchia versione.

:roll_eyes: alla fine mi sono fermato.

considerato che mostrando solo 4 linee occupava il 22% dello spazio per i programmi non mi sembra il caso di procedere oltre (sono circa 30 parametri)... e ancora non ho scritto le funzioni per incrementare e diminuire i relativi parametri (che non sono tutti dello stesso 'tipo')

onestamente non pensavo che l'impatto del solo menu sul codice fosse cosi elevato, ma d'altro canto anche arduino (deve) avere qualche contra, giusto ? :confused: .....oppure, piu verosimilmente, sono ( ancora?) scarso con il C :smiley: