Hi everyone,
I' am making a project with an Arduino (for now I'am using the nano but maybe I will use an UNO in the future) as a challenge and as a final project for high school. I am trying to build a "PC" with arduino
. I want to create something similar to TinyBasicPlus but I'am developing the project in my way.
So far everything is going great, I can write the command in the Serial monitor, the arduino will store it in a linked list an then execute it.
This is an example of a line of my "pseudo-code": 10 PRINT "HELLO WORLD".
The first number is the line number (each line will be executed according to it's line number), the other part of the string is the instruction that will be executed.
typedef struct {
short int lineNumber;
char instruction[100];
} line_t;
typedef struct node {
line_t line;
node* next;
} node;
This is the node of the string.
Now I need to store this linked list containing every line of my code in the EEPROM.
My goals are:
- save one or more program (so one or more list) on the eeprom
- retrieve the list from the eeprom
- modify the list, and save it againg
I am considering my alternatives.
I could merge the list in a long string, this is the easyest method but then i will have trouble when i need to edit the list and maybe add some line of my pseudo-code. I don't want to rewrite all the eeprom again.
So i would like to keep the list structure. I was thinking about adding a node at the beginning of my program list containing it's name, a pointer to the first element of the list and a pointer to another list. Some kind of list of list.
So something like this:
"first program", *firstProgramPointer , *nextProgram
Mantaining the list structure would also be helpfull to add some node to the list without having to rebuild the entire eeprom structure, i could create an overflow zone at the end and put there every new node.
Is this a good approach? I don't have much expirience with classic database...
I hope I was clear. Thanks for reading.