]> git.piffa.net Git - sketchbook_andrea/blob - advanced_projects/eeprom_2_stringa_avr/eeprom_2_stringa_avr.ino
Serial and eeprom
[sketchbook_andrea] / advanced_projects / eeprom_2_stringa_avr / eeprom_2_stringa_avr.ino
1 /*
2   EEPROM 
3  
4  Storaggio di un stringa di caratteri in EEPROM e sucessiva lettura
5  usando le libreire AVR: /usr/lib/avr/include/avr/eeprom.h
6  */
7
8 #include <avr/eeprom.h> // 
9
10 // the current address in the EEPROM (i.e. which byte
11 // we're going to write to next)
12 int addr = 100;
13 char testo[23] ;
14 void setup()
15
16   char message[] = "Testo messaggio";
17   Serial.begin(9600);
18   Serial.println("Storaggio valore");
19
20   //eeprom_write_block(message, (void *)addr, strlen(message) + 1);
21   // Pointer all'array di carattere, punto in cui scrivere (su 1023), lunghezza
22   // Eseguire una volta sola, caricare lo sketch
23   // e immediatamente commetare e ripetere l'upload.
24 }
25
26 void loop()
27 {
28   Serial.print("Lettura Valore: ");
29   eeprom_read_block(&testo, (void *)addr,23);
30   Serial.println(testo); 
31   Serial.flush();
32   exit(0) ;
33 }
34
35