Hi!
I'm not soo good at programming so this might be an easy fix but i can't think of one.
I'm trying to store 2 values in different variables but I'm having trouble doing it, I've already manage to store 1 of them (lmax).
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
byte rowPins[ROWS] = {2, 10, 11, 12}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {13, 7, 8}; //connect to the column pinouts of the kpd
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
unsigned long loopCount;
unsigned long startTime;
String msg;
int lmax = 0;
int lmin = 0;
int getKeypadIntegerMulti()
{
int value = 0; // the number accumulator
int keyvalue; // the key pressed at current moment
int isnum;
do
{
keyvalue = keypad.getKey(); // input the key
isnum = (keyvalue >= '0' && keyvalue <= '9'); // É um digito?
if (isnum)
{
Serial.print(keyvalue - '0');
value = value * 10 + keyvalue - '0'; // accumulate the input number
}
} while (isnum || !keyvalue);// until not a digit or while no key pressed
return value;
}//getKeypadInteger
void setup() {
lmax = lmax + getKeypadIntegerMulti();
lcd.init(); // initialize the lcd
lcd.init();
lcd.backlight();
lcd.print("Limite Max.:");
lcd.print(lmax);
}
void loop() {
}
Here's the code, I'd appreciate if you guys could help me!