Timeline for How to add data without pre-defining variables?
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 6, 2015 at 0:43 | comment | added | TL140 | Both of the answers are very good and you have helped me a lot more. I tossed up between which one to pick and honestly yours is the better pick because most of my questions have been answered.I mainly voted his because it has one upvote and im too low rep to upvote yours. Still new to SE so im not sure how it works in its entirety. | |
| Jun 5, 2015 at 23:39 | comment | added | CharlieHanson | @TL140 Now I feel somewhat guilty, I didn't mean to demand my answer be chosen. I recommend you search for information on the Arduino library EEPROMex. It's an extension for the standard EEPROM library and I think it will explain all manner of aspects of correctly and efficiently utilising the EEPROM. I've only just found it, and it looks pretty ace. | |
| Jun 5, 2015 at 23:35 | vote | accept | TL140 | ||
| Jun 5, 2015 at 18:14 | comment | added | CharlieHanson | @TL140: As you've chosen an answer (which wasn't mine!) I shalln't continue with my answer. If you need further assistance, perhaps start a new question with your specific problem. | |
| Jun 5, 2015 at 2:26 | comment | added | TL140 | I see! I was under the misconception that it wrote a new value to it each time, so that if I accidentally coded an infinite for loop (I may be an intermediate level programmer, but I know way better than this! just using the worse case scenario.), 100,000 cycles that the code runs would burn out the EEPROM in minutes. Now I know that it doesn't work that way. I appreciate all your help! Thank you a ton! | |
| Jun 5, 2015 at 1:20 | comment | added | CharlieHanson | I'll come back to my answer later (it's 2am) and start on some list-management explanations, with reduced EEPROM-write dependencies. Your board will be safe, I promise! | |
| Jun 5, 2015 at 1:15 | comment | added | CharlieHanson |
Wait a second: do you realise how much 100,000 is? Unless you're really trying you'll never reach that high! And don't forget it's write cycles; reading it is unlimited. To further convince you that it's OK, the EEPROM.put() function calls a sub-function called EEPROM.update(), which is a magic function that only writes a value to an address if the existing value is different. If your loop() function contains only one line: EEPROM.put(0, "Relax, TL140");, you could run your Arduino forever, and restart it to your hearts content, and the EEPROM would only ever be written to once.
|
|
| Jun 5, 2015 at 0:51 | comment | added | TL140 | Awesome! I think im catching on little by little. Still foggy on structs but they are a new concept for a new language so I'll just need to practice. I'll probably use a big array to simulate the EEPROM since I dont want to ruin my board's. I'm guessing I should also store a pointer in the EEPROM to reference my list? or is there a way i can read my EEPROM and see just how much space is already stored in it, then use that? Because, wouldn't updating that counter every time a card was read ruin my EEPROM pretty fast? | |
| Jun 5, 2015 at 0:38 | vote | accept | TL140 | ||
| Jun 5, 2015 at 0:38 | |||||
| Jun 4, 2015 at 13:02 | comment | added | CharlieHanson | And as to why EEPROM has limited write-cycles: Google it! It's related to the way that data is stored so that its integrity remains once you remove power to it. As with everything, it's a trade-off between features. | |
| Jun 4, 2015 at 12:55 | comment | added | CharlieHanson |
@TL140 As part of your 'list management' you write a function for adding new entries. When it begins you create a new structure struct personalProfile NewEntry then fill in the details how you like, i.e. the name fields are typed in by Sally herself and the card details are automatically entered from the RFID reader. Call EEPROM.put() which copies the data from NewEntry, byte for byte, into the EEPROM. When your add-new-entries function finishes, NewEntry falls out of scope (it gets forgotten about, rather then strictly deleted), but the version in the EEPROM remains forever.
|
|
| Jun 4, 2015 at 5:40 | comment | added | TL140 | I will have to use arrays with just the raw data and indexing. which I do not mind. But thank you for the tutorial on Structs, and the references. Also, Why can the EEPROM only be used 10k times? | |
| Jun 4, 2015 at 5:38 | comment | added | TL140 | WOW! a lot of info here. Love it. I have dealt with class/objects in JS and Python, but never knew about Structs in C. The only thing that I am fairly concern about is would I have to create each object by hand? because that is what I am trying to get around. I understand the storing part of them and pushing them to the EEPROM, and indexing them to reference, but it is more on the creation part that I am getting hung up on. Such as sally scanning her RFID card, enter her name, the objects are then automatically created under that class, and stored after that. So far, it's looking like... | |
| Jun 3, 2015 at 17:08 | history | answered | CharlieHanson | CC BY-SA 3.0 |