Arduino  1.8.10
scripts_library.h
[詳解]
1 #include <avr/pgmspace.h>
2 #include <ArduinoRobot.h>
3 
4 const char script1[] PROGMEM="Wheel Calibration\n";
5 const char script2[] PROGMEM="1. Put Robot on a flat surface\n";
6 const char script3[] PROGMEM="2. Adjust speed with the knob on top\n";
7 const char script4[] PROGMEM="3. If robot goes straight, it's done\n";
8 const char script5[] PROGMEM="4. Use screwdriver on the trim on bottom\n";
9 const char script6[] PROGMEM="Robot turns left, screw it clockwise;\n";
10 const char script7[] PROGMEM="Turns right, screw it ct-colockwise;\n";
11 const char script8[] PROGMEM="5. Repeat 4 until going straight\n";
12 
13 char buffer[42];//must be longer than text
14 
15 const char * const scripts[] PROGMEM = {
16  script1,
17  script2,
18  script3,
19  script4,
20  script5,
21  script6,
22  script7,
23  script8,
24 };
25 
26 void getPGMtext(int seq){
27  strcpy_P(buffer,(char*)pgm_read_word(&(scripts[seq])));
28 }
29 
30 void writePGMtext(int seq){
31  getPGMtext(seq);
33 }
34 
35 void writeScript(int seq){
36  writePGMtext(seq);
37 }
38 
40  for(int i=0;i<8;i++){
41  writeScript(i);
42  }
43 }
char buffer[42]
void writePGMtext(int seq)
uint8_t i
RobotControl Robot
char * strcpy_P(char *, const char *)
void getPGMtext(int seq)
size_t print(const __FlashStringHelper *)
Definition: Print.cpp:44
void writeScript(int seq)
const char script1 [] PROGMEM
void writeAllScripts()
#define pgm_read_word(address_short)
Definition: pgmspace.h:1064