[136] | 1 | #include <avr/pgmspace.h>
|
---|
| 2 |
|
---|
| 3 | //an advanced trick for storing strings inside the program space
|
---|
| 4 | //as the ram of Arduino is very tiny, keeping too many string in it
|
---|
| 5 | //can kill the program
|
---|
| 6 |
|
---|
| 7 | const char hello_user_script1[] PROGMEM="What's your name?";
|
---|
| 8 | const char hello_user_script2[] PROGMEM="Give me a name!";
|
---|
| 9 | const char hello_user_script3[] PROGMEM="And the country?";
|
---|
| 10 | const char hello_user_script4[] PROGMEM="The city you're in?";
|
---|
| 11 | const char hello_user_script5[] PROGMEM=" Plug me to\n\n your computer\n\n and start coding!";
|
---|
| 12 |
|
---|
| 13 | const char hello_user_script6[] PROGMEM=" Hello User!\n\n It's me, your robot\n\n I'm alive! <3";
|
---|
| 14 | const char hello_user_script7[] PROGMEM=" First I need some\n\n input from you!";
|
---|
| 15 | const char hello_user_script8[] PROGMEM=" Use the knob\n\n to select letters";
|
---|
| 16 | const char hello_user_script9[] PROGMEM=" Use L/R button\n\n to move the cursor,\n\n middle to confirm";
|
---|
| 17 | const char hello_user_script10[] PROGMEM=" Press middle key\n to continue...";
|
---|
| 18 | const char hello_user_script11[] PROGMEM=" Choose \"enter\" to\n\n finish the input";
|
---|
| 19 |
|
---|
| 20 | const char * const scripts_Hello_User[] PROGMEM = {
|
---|
| 21 | hello_user_script1,
|
---|
| 22 | hello_user_script2,
|
---|
| 23 | hello_user_script3,
|
---|
| 24 | hello_user_script4,
|
---|
| 25 | hello_user_script5,
|
---|
| 26 | hello_user_script6,
|
---|
| 27 | hello_user_script7,
|
---|
| 28 | hello_user_script8,
|
---|
| 29 | hello_user_script9,
|
---|
| 30 | hello_user_script10,
|
---|
| 31 | hello_user_script11,
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 | /*
|
---|
| 35 | void getPGMtext(int seq){
|
---|
| 36 | //It takes a string from program space, and fill it
|
---|
| 37 | //in the buffer
|
---|
| 38 | strcpy_P(buffer,(char*)pgm_read_word(&(scripts[seq])));
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | void writeScript(int seq, int line, int col){
|
---|
| 42 | //print a string from program space to a specific line,
|
---|
| 43 | //column on the LCD
|
---|
| 44 |
|
---|
| 45 | //first fill the buffer with text from program space
|
---|
| 46 | getPGMtext(seq);
|
---|
| 47 | //then print it to the screen
|
---|
| 48 | textManager.writeText(line,col,buffer);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | */
|
---|