Dear Pro Users,
since I have startet studing (instead of working) I got a bit time on my hand, then my girlfriend bought a little aquarium and so I though "let's automate it!" I have worked with industriel PLC Controller, but an Arduino LCD Menu System is kind off over my head.
The last days I googled a lot to this thema, what I found out is that there is a couple library I could use. User olikraus, writer from m2tklib, has made a list. See hear -->LiberyList
I first intendet to "Copy" the Marlin LCD Menu for 3D Printers with a rotary encoder and a button because it's so simple to handle, but I was not able to extraxt it from all the code. So I though I have to use one of the library avalible. But wich on?
I tried a bit with m2tklib "Lib Elements"and a example I found, but yeah it was not going in the direction I'd like to.
It would be awesome if you guys could help me find the best lib for my struktur, or at least give me a idea how I should change it to make it the most simple way.
Thanks!!
Don't take to code to serious, i tried it the first time yesterday night
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "M2tk.h"
#include "utility/m2ghnlc.h"
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
//=================================================
// Forward declaration of the toplevel element
M2_EXTERN_ALIGN(top_menu);
//=================================================
uint8_t TargetTemp = 0;
uint8_t SetpointTemp = 0;
uint8_t AlarmTemp = 0;
uint8_t PID_ManAuto = 0;
uint8_t Xd =20;
uint8_t Xi = 0;
uint8_t Xs = 0;
uint8_t LightOnOff = 0;
uint8_t LightMaxY = 0;
uint8_t LightMinY = 0;
uint8_t Fertilizer = 0;
//Default screen
M2_LABEL(el_9, NULL, "Temp");
M2_LABEL(el_10, NULL, "Y Light:");
M2_LABEL(el_l1, NULL, "Set.Temp:");
M2_U8NUM(el_u1, "c2", 0, 99, &SetpointTemp);
M2_LABEL(el_l2, NULL, "Xd");
M2_U8NUM(el_u2, "c2", 0, 99, &TargetTemp);
M2_LIST(list) = { &el_9, &el_10 ,&el_l1, &el_u1, &el_l2, &el_u2 };
M2_GRIDLIST(el_gridlist, "c2", list);
M2_ALIGN(top_menu, "-0|1W64H64", &el_gridlist);
// m2 object and constructor
// Note: Use the "m2_eh_4bd" handler, which fits better to the "m2_es_arduino_rotary_encoder"
M2tk m2(&top_menu, m2_es_arduino_rotary_encoder, m2_eh_4bd, m2_gh_nlc);
//=================================================
// Arduino Setup & Loop
void setup() {
 m2_SetNewLiquidCrystal(&lcd, 16, 2);
 // define button for the select message
 m2.setPin(M2_KEY_SELECT, 2);
 // The incremental rotary encoder is conected to these two pins
 m2.setPin(M2_KEY_ROT_ENC_A, 3);
 m2.setPin(M2_KEY_ROT_ENC_B, 4);
}
void loop() {
 m2.checkKey();
m2.checkKey();
 if ( m2.handleKey() )
  m2.draw();
 m2.checkKey();
 m2.checkKey();
  m2.checkKey();
}
ProjectMenuStruktur.pdf (125 KB)
ProjectMenuStrukturSetupPicture.pdf (454 KB)