Hi all, thanks for reading and thanks in advance for your help
here is the thing I'm a total nooby and like the title says it I need you to point me to the right direction
here in this webpage it says the following: "The microcontroller on the Arduino boards have 512 bytes of EEPROM: memory whose values are kept when the board is turned off (like a tiny hard drive)"
I understant the part that says "Arduino boards have 512 bytes" that's a small piece of memory where we can save data to read it later even if we turn the Arduino board off with that been said here what I dont understand: ==>>(How many characters or how many numbers or how long the number it can be)
I'm guessing we can only save a number 0 to 255 meaning the number 255 would be the longest or higher number that we can storage in the EEPROM I got that from the example code below but I don't know if I'm right or not on the other hand I have this other in formation from this website that said the following:
"How many characters is 255 bytes?
Ascii only uses the first 7 bits of each byte, but every character still takes up one byte. 255 bytes would be 255 characters here."
There I see that it says that "255 bytes would be 255 characters here." so what I understand that I can save 255 characters in the EEPROM that would be a long line of characters or numbers
Here is is the point i don't know how many characters I can store in the EEPROM and I need you to tell me the truth.
thanks...
/*
* EEPROM Write
*
* Stores values read from analog input 0 into the EEPROM.
* These values will stay in the EEPROM when the board is
* turned off and may be retrieved later by another sketch.
*/
#include <EEPROM.h>
/** the current address in the EEPROM (i.e. which byte we're going to write to next) **/
int addr = 0;
void setup() {
/** Empty setup. **/
}
void loop() {
/***
Need to divide by 4 because analog inputs range from
0 to 1023 and each byte of the EEPROM can only hold a
value from 0 to 255.
***/
int val = analogRead(0) / 4;
/***
Write the value to the appropriate byte of the EEPROM.
these values will remain there when the board is
turned off.
***/
EEPROM.write(addr, val);
/***
Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/
addr = addr + 1;
if (addr == EEPROM.length()) {
addr = 0;
}
/***
As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an
EEPROM address is also doable by a bitwise and of the length - 1.
++addr &= EEPROM.length() - 1;
***/
delay(100);
} or paste code here
You can store any type of digital data in EEPROM. One EEPROM cell can hold a single byte, or value 0 to 255, but you can combine cells to store long integers, float variables or text.
The EEPROM that you are referring to can hold up to 512 bytes of data. Each byte can have a values between 0 and 255 but a combination of bytes can be used to represent any value that you want
Forget the EEPROM for now. On an AVR processor such as the 328 used on a Uno, an int variable (signed or unsigned) uses 2 bytes, a long (signed or unsigned) uses 4 bytes as does a float.
So, when you save the values to EEPROM you need to take that into account
512 bytes of EEPROM can hold 512 byte variables (of course), or 256 int variables or 128 long or float variables. A single character fits in a single byte so you can store 512 characters in a 512 byte EEPROM
The easiest functions to use to save and retrieve values when working with EEPROM are put() and get() as they handle all the nasty complications of putting the bytes that represent larger values into EEPROM and getting them back again
It is still your responsibility to allow for the space needed for the storage. For instance, you cannot put() an int variable into EEPROM positions 0 and 1 because the byte values that they are made up of will overlap at position 1
As AWOL has pointed out an AVR actually has 1024 bytes of EEPROM available so twice as many variables of any type can be held compared to your example 512 byte EEPROM
ok so we have 255 cells meaning we can store 255 characters one in each cell or numbers from 0 to 255 each number on different cells so I can store the number 255 255 times
Am I right on this?? by the way I'm using the Leonardo board
@UKHeliBob
I'm planning to store lower and Upper case letters, numbers and some characters from a normal English keyboard those characters are characters like: @#$&+()/_!? And so on.
By the way do you think characters like:@#$_&-+()/!? Mete the one byte criteria?
Oh and the letter Ñ and ñ from the Spanish alphabet