How to use EEPROM write anything


hi guys,

i'm trying write string eeprom i'm not having success sketch, i've put togeather form examples i've seen wont work, have done wrong?

code: [select]
#include <eeprom.h>
#include "eepromanything.h"

char string1; //where eeprom_readanything save data to

void setup()
{
  char* fox = "the quick brown fox"; //send eeprom
  byte len = (byte) strlen (fox);
  eeprom_writeanything (0, len);
  eeprom_writeanything (1, fox);
}
void loop()
{
   if(eeprom_readanything(0, string1))
    serial.println("marker"); //see if happens on sm
    serial.println(string1);
}


thanks
cal

hi guys,

i have compose sketch doesn't seem fact want write data,dec eeprom

here sketch

code: [select]
#include <eeprom.h>

int address = 0;

void setup()
{
  serial.begin(9600);
 
  string data = "hello there!";//string needs on eeprom
 
  for(int = 0; < data.length(); i++)  {
      if (i > 0)  {
        long dd = data[i],dec; //copy string long dd
        eeprom.write(address, dd); //write string
        address = address + 1;// move next eeprom address
        }
      }
}

void loop()
{

}


and here error code

code: [select]
arduino: 1.5.8 (windows 7), board: "arduino uno"

in file included c:\program files\arduino\hardware\arduino\avr\cores\arduino/stream.h:26:0,
                 from c:\program files\arduino\hardware\arduino\avr\cores\arduino/hardwareserial.h:29,
                 from c:\program files\arduino\hardware\arduino\avr\cores\arduino/arduino.h:223,
                 from eeprom_write.ino:3:
eeprom_write.ino: in function 'void setup()':
c:\program files\arduino\hardware\arduino\avr\cores\arduino/print.h:29:13: error: expected unqualified-id before numeric constant
 #define dec 10
             ^
eeprom_write.ino:13:27: note: in expansion of macro 'dec'
error compiling.

  report have more information with
  "show verbose output during compilation"
  enabled in file > preferences.


any 1 know how can different way wont blow brain cells lol (tgif) :smiley-mr-green:  :smiley-mr-green:  :smiley-mr-green:


Arduino Forum > Using Arduino > Programming Questions > How to use EEPROM write anything


arduino

Comments

Popular posts from this blog

arduino bug sur secteur, batterie, mais pas en usb?

Static ip - Raspberry Pi Forums

What voltage is sent to the arduino GND when a transistor is used