Go Down

Topic: EEprom (Read 262 times) previous topic - next topic

necoli35

Hi, I want to save the char type information that I sent to Arduino with hc-05 module to eeprom and I want it to be displayed on the P10 panel again when the energy of the memory is cut off and re-issued. I have not succeeded with read-write-uprage commands.

UKHeliBob

Post the code that you tried and describe what is wrong
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

necoli35

Post the code that you tried and describe what is wrong
I do not have a problem with viewing the writers. The only problem I am having is saving the data I sent from bluetooth to save in the eeprom

pert

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it's ok to add it as an attachment.

When your code requires a library that's not included with the Arduino IDE please always post a link(using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

The only problem I am having is saving the data I sent from bluetooth to save in the eeprom
That's not a good enough description of the problem for us to be able to help you. Do you expect us to spend 10 to 15 minutes looking through your code and writing an explanation of what you did wrong when you won't take 3 minutes to explain the problem. Help us to help you.

necoli35

Code: [Select]

#include <SPI.h> //* Spı kütüphanesini cagirdim
#include <EEPROM.h>
#include <DMD.h> //* DMD kütüphanesini cagirdim
#include <TimerOne.h> //* Timerone kütüphanesini cagirdim
#include "SystemFont5x7.h" //* Yazilacak fontu 5x7 boyutunda ayarladim
#include "Arial_black_16.h" //* Yazinin fontunu arial black olarak ayarladim.

#define DISPLAYS_ACROSS 1 //* P10un boyut ayari
#define DISPLAYS_DOWN 1   //* P10un boyut ayari
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN); //* P10un boyut ayari
#define max_char 32       //* gonderdigim mesajin maximum boyutu ayarladim
char message[max_char];    //* gonderdigim mesaji mesaj boyutu ile char metin olarak tanimladim
char r_char;                //* Okuyacagim veri
int address = 0;
char serial_in_data;
byte index = 0;             //* Olusturdugum donguler icin index girisi
int i;                      //* Olusturdugum donguler icin i girisi
void ScanDMD()

{
  dmd.scanDisplayBySPI();         //* DMDyi baslat
}

void setup(void)
{
  Timer1.initialize( 5000 );
  Timer1.attachInterrupt( ScanDMD ); //* 5saniyede P10u tara
  dmd.clearScreen( true );
  Serial.begin(9600);                 //* Haberlesmeyi 9600 bound rate ile baslat
  message[index] = EEPROM.read(address);

  
}
void loop(void)
{
  if (Serial.available()) {          //*Tampon bellekteki okunmayi bekleyen verileri denetledim
    for (i = 0; i < 99  ; i++) {
      message[i] = '\0';
    }
    index = 0;
    }
  while (Serial.available() > 0) {        //*Tampon bellekteki okunmayi bekleyen verileri denetledim gonderdigim veriyi messega ile esitledim
    if (index < (max_char - 1))
    {
      r_char = Serial.read();
      message[index] = r_char;
      index++;
      message[index] = '\0';
    
  
    }

  
  }
     EEPROM.write(address, message[index]);
  dmd.clearScreen( true );                   //* Ekrani temizledim.
  dmd.selectFont(Arial_Black_16);
  dmd.drawMarquee(message, max_char, (32 * DISPLAYS_ACROSS) - 1 , 0);      //* Seri yoldan aldigim veriyi P10a bastigim komut

  long start = millis();                                           //* Kayan yazı olmasi icin zamanlayicilari kullandim
  long timer = start;
  boolean ret = false;
  while (!ret) {
    if ((timer + 30) < millis()) {
      ret = dmd.stepMarquee(-1, 0);
      timer = millis();

}
}
  }

  

pert

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason just make for more scrolling when we're trying to read your code.

When your code requires a library that's not included with the Arduino IDE please always post a link(using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

That's not a good enough description of the problem for us to be able to help you. Do you expect us to spend 10 to 15 minutes looking through your code and writing an explanation of what you did wrong when you won't take 3 minutes to explain the problem. Help us to help you.

necoli35

Code: [Select]

#include <SPI.h> //* Spı kütüphanesini cagirdim
#include <EEPROM.h>
#include <DMD.h> //* DMD kütüphanesini cagirdim
#include <TimerOne.h> //* Timerone kütüphanesini cagirdim
#include "SystemFont5x7.h" //* Yazilacak fontu 5x7 boyutunda ayarladim
#include "Arial_black_16.h" //* Yazinin fontunu arial black olarak ayarladim.

#define DISPLAYS_ACROSS 1 //* P10un boyut ayari
#define DISPLAYS_DOWN 1   //* P10un boyut ayari
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN); //* P10un boyut ayari
#define max_char 32       //* gonderdigim mesajin maximum boyutu ayarladim
char message[max_char];    //* gonderdigim mesaji mesaj boyutu ile char metin olarak tanimladim
char r_char;                //* Okuyacagim veri
int address = 0;
byte index = 0;             //* Olusturdugum donguler icin index girisi
int i;                      //* Olusturdugum donguler icin i girisi
void ScanDMD()

{
  dmd.scanDisplayBySPI();         //* DMDyi baslat
}

void setup(void)
{
  Timer1.initialize( 5000 );
  Timer1.attachInterrupt( ScanDMD ); //* 5saniyede P10u tara
  dmd.clearScreen( true );
  Serial.begin(9600);                 //* Haberlesmeyi 9600 bound rate ile baslat



}
void loop(void)
{
  char vvv = EEPROM.read(address);
  if (Serial.available()) {          //*Tampon bellekteki okunmayi bekleyen verileri denetledim
    for (i = 0; i < 99  ; i++) {
      message[i] = '\0';
    }
    index = 0;
  }
  while (Serial.available() > 0) {        //*Tampon bellekteki okunmayi bekleyen verileri denetledim gonderdigim veriyi messega ile esitledim
    if (index < (max_char - 1))
    {
      r_char = Serial.read();
      message[index] = r_char;
      index++;
      message[index] = '\0';


    }


  }
  EEPROM.write(address, message);

  dmd.clearScreen( true );                   //* Ekrani temizledim.
  dmd.selectFont(Arial_Black_16);
  dmd.drawMarquee(vvv, max_char, (32 * DISPLAYS_ACROSS) - 1 , 0);      //* Seri yoldan aldigim veriyi P10a bastigim komut

  long start = millis();                                           //* Kayan yazı olmasi icin zamanlayicilari kullandim
  long timer = start;
  boolean ret = false;
  while (!ret) {
    if ((timer + 30) < millis()) {
      ret = dmd.stepMarquee(-1, 0);
      timer = millis();

    }
  }
}



pert

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason just make for more scrolling when we're trying to read your code.

When your code requires a library that's not included with the Arduino IDE please always post a link(using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.
That's not a good enough description of the problem for us to be able to help you. Do you expect us to spend 10 to 15 minutes looking through your code and writing an explanation of what you did wrong when you won't take 3 minutes to explain the problem. Help us to help you.

necoli35

I am sending my problem via Hc-05 and save the data to the EEPROM and print this data panel all the time except save the current one only problem is saving the data

cattledog

Use EEPROM.put and EEPROM.get.

.write() and.read() are for single byte data. You are storing and retreiving a multibyte character string. Take a look at the eeprom.h library examples and read the documentation for the library.

Go Up