Thanks Jurs
Yes I looked into eeprom and found I had the library for it already on my ide.
I was sruggling to include it into my code.
This Is my code so far, could you help me include the EEPROM code?
//Using LiquidCrystal library
#include <LiquidCrystal.h>
/*******************************************************
This program will add a value and display it. To increment
use the UP and DOWN button.
*******************************************************/
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
int Machine = 0;
int pin13 = 0;
#define btnUP 1
#define btnDOWN 2
#define btnSELECT 3
// declair funtion to read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
// For V1.1 us this threshold
/*
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
*/
// For V1.0 comment the other threshold and use the one below:
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 790) return btnSELECT;
}
void setup()
{
lcd.begin(16, 2); // start the library
pinMode(13,OUTPUT);
}
void loop()
{
lcd_key = read_LCD_buttons();
static int value1 = 0;
if (lcd_key == 1)
{
value1 = constrain(value1 + 1, -30, 30); // I only wanted it to count from (-30)-(+30) and back
}
else if (lcd_key == 2)
{
value1 = constrain(value1 - 1, -30, 30); // I only wanted it to count from (-30)-(+30_)and back
}
lcd.setCursor(0, 0);
lcd.print("Select Machine: ");
lcd.setCursor(0, 3);
lcd.print(value1); // displays the count
lcd.print(" "); //This space is here to clear the double digit area.
delay(150);
}