how to change eeprom via lcd display

im having a little problem working out how to sort this out if any has any ideas please post

im reading a password from eeprom

   secretCode[0] = EEPROM.read(1);
    secretCode[1] = EEPROM.read(2);
    secretCode[2] = EEPROM.read(3);
    secretCode[3] = EEPROM.read(4);

ok i can display ( read from eeprom to lcd )

  lcd.setCursor(0, 2);
  lcd.print(secretCode[0]);
  lcd.print(secretCode[1]);
  lcd.print(secretCode[2]);
  lcd.print(secretCode[3]);

this is the problem as its not string its char how do it does this??
need a way to convert char to spring so i can use the cursor to change numbers then save to eeprom new code

String setString;

Create a character array, 0 terminated
Use a for loop, step through your EEPROM and load your character array.

Here is my full code im not the best coder but it all working to what i need , i can change password and save to eeprom from keypad and lcd1 , but like to have the option to change password via lcd via menu,

i running lcd1 and keypad ( if code entered soliend opens the door and turns on lcd 20x4 and able ir remote as menu is running from remote also my lights

sorry had to add attachment to big lol

if anyone could improve the code please do or pick errors its not 100% finished,
will be added

if temp is ?? then open vents also i need to add a button to release door then door closed,
i do have a rtc chip but having problems coding in , would look noce with date and time i think

code.txt (16.9 KB)

reading and write to eeprom is char

i need to change to setstring for lcd anyideas

desiredTempC = EEPROM.read(10);

how do i change deiredTempC anwser to String setString;
so i can change via the lcd and then i need to send the answer back to eeprom

my code

void on_changesettemp(MenuItem* p_menu_item)
{
  setString = deiredTempC;
  lcd.setCursor(0, 2);
  lcd.print(setString);
  cursorPosition = 0;
  lcd.setCursor(cursorPosition, 2);
  lcd.blink();
  setMenu = Temp;
  menuSelected = true;

}

setString = deiredTempC; char to string is there a way i can hold char array and use lcd to change value ??

i have the same problem with the passcode reading from eeprom to display on lcd so i can change code then send back to eeprom

as it char the lcd will not let me change value, is there a easy way around this

reading and write to eeprom is char

A char is not a string OR a String.

Why do you insist on pissing away resources using Strings?

When you post all of your code, we’ll talk.

First if you would of read my post you would of noticed I have posted my full code as a attachment called code.txt

Second I'm trying to change my password via lcd 16x2 using a remote menu and cursor to change value

Again I know a char is not string and I didn't say it was,

Eg
If eeprom 10 value is 38
I could change value via menu
Using the cursor on lcd
Submit value back to eeprom

String setString;
int desiredTempC = EEPROM.read(10);

my menu

void on_temp_set_selected(MenuItem* p_menu_item)
{
  setString = desiredTempC; /// this is my problem 
  lcd.setCursor(0, 2);
  lcd.print(setString);
  cursorPosition = 0;
  lcd.setCursor(cursorPosition, 2);
  lcd.blink();
  setMenu = TEMPSET;
  menuSelected = true;

}

same poblem for my password

where my password is keep

    secretCode[0] = EEPROM.read(1);
    secretCode[1] = EEPROM.read(2);
    secretCode[2] = EEPROM.read(3);
    secretCode[3] = EEPROM.read(4);
void on_password_set_selected(MenuItem* p_menu_item)
{
  setString = ??????????; /// this is my problem 
  lcd.setCursor(0, 2);
  lcd.print(setString);
  cursorPosition = 0;
  lcd.setCursor(cursorPosition, 2);
  lcd.blink();
  setMenu = passwordSET;
  menuSelected = true;

}

setString = ??????????; /// this is my problem

So, quit using Strings. Use itoa() to convert an int to a string. The password characters, if stored in a char array, and followed by a NULL would BE a string.

The LiquidCrystal library variations KNOW how to display a string.

so how would i write itoa() ???

so how would i write itoa()

You don't need to. The function already exists. You just need to call it.

You don't need to. The function already exists. You just need to call it.??

how do i call it please can you show me ty

setup

int desiredTempC = EEPROM.read(10); // read temp set from eeprom
String str;  //declaring string
char b[5];   //declaring character array

menu code

void on_changesettemp(MenuItem* p_menu_item)
{

  setString = b;
  lcd.setCursor(0, 2);
 lcd.print(setString);
  cursorPosition = 0;
  lcd.setCursor(cursorPosition, 2);
  lcd.blink();
  setMenu = SECRETCODE;
  menuSelected = true;

}




 setMenu = SECRETCODE
    str=String(desiredTempC); //converting integer into a string
  str.toCharArray(b,3); //passing the value of the string to the character array

 EEPROM.write(10, b); // write back to eeprom

i can view and change on lcd but getting this
error: invalid conversion from 'char*' to 'uint8_t {aka unsigned char}' [-fpermissive]

Pauls i did try you why but i dont understand how to do it,
if anyone know the best way to
read from eeprom
display and be able to change value on a lcd
write back to eeprom
let me know or put a snippet

how do i call it please can you show me ty

Google can, faster than I.

/// setup///////////////
String setString; // holds string
int desiredTempC = EEPROM.read(10); //reads result from eeprom
char str[10];
////// menu/////////////////////////////////////
void on_changesettemp(MenuItem* p_menu_item)
{
   itoa (desiredTempC,str,10); // convert eeprom to str
  setString =str;
  lcd.setCursor(0, 2);
 lcd.print(setString);
  cursorPosition = 0;
  lcd.setCursor(cursorPosition, 2);
  lcd.blink();
  setMenu = SECRETCODE;
  menuSelected = true;
}

how would i write setString back to eeprom ?????

atoi ?

According to the Arduino homepage

The Arduino language is based on C/C++. It links against AVR Libc and allows the use of any of its functions; see its user manual for details.

The user manual for AVR libc is here:
http://www.nongnu.org/avr-libc/user-manual/index.html

The atoi function, which converts strings to integers, is here:
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html

Have a look through the stdlib and other pages to get a feel for what kinds of functions are available as part of the standard C libraries.

stall20080:
how would i write setString back to eeprom ???

Wrong question.

First question would be:
How can I replace the most wasteful and ineffective ‘String’ object “String setString;” with a real C-String?

Every usage of “String” declaration is the start of bad Arduino programming practice.

“String” objects are always a bad choice for all type of Arduino programs (except most silly ‘example’ sketches perhaps).

For the possibly only advantage that you can assign “String” objects with usage of the equals “=” sign, you swap nothing else than problems, problems, problems.

How can I replace the most wasteful and ineffective 'String' object "String setString;" with a real C-String?

how ???

stall20080:
How can I replace the most wasteful and ineffective 'String' object "String setString;" with a real C-String?

how ???

The easiest way to do so would be:
When starting to write an Arduino sketch, never ever write the word 'String' in your code!

Changing an existing sketch from "String" C++ objects to using C-strings later is much more complicated. And, of course, you'd then have to observe the whole code of the existing sketch. There is no easy way of "search and replace" to search for the mess in your code and replace with good code.

BTW: When saving numerical values in an EEPROM, it would be a good programming practice not to save a 'String object' and even not a 'C-string' in the EEPROM, but a 'numerical value'.