source: rtos_arduino/trunk/arduino_lib/libraries/Robot_Control/examples/explore/R11_Hello_User/R11_Hello_User.ino@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 4.7 KB
Line 
1/* Hello User
2
3 Hello User! This sketch is the first thing you see
4 when starting this robot. It gives you a warm welcome,
5 showing you some of the really amazing abilities of
6 the robot, and make itself really personal to you.
7
8 Circuit:
9 * Arduino Robot
10
11 created 1 May 2013
12 by X. Yang
13 modified 12 May 2013
14 by D. Cuartielles
15
16 This example is in the public domain
17 */
18
19#include <ArduinoRobot.h> // include the robot library
20#include <Wire.h>
21#include <SPI.h>
22
23// include the utility function for ths sketch
24// see the details below
25#include <utility/RobotTextManager.h>
26
27char buffer[20];//for storing user name
28
29void setup() {
30 //necessary initialization sequence
31 Robot.begin();
32 Robot.beginTFT();
33 Robot.beginSD();
34
35 // show the logos from the SD card
36 Robot.displayLogos();
37
38 // clear the screen
39 Robot.clearScreen();
40
41 // From now on, display different slides of
42 // text/pictures in sequence. The so-called
43 // scripts are strings of text stored in the
44 // robot's memory
45
46 // these functions are explained below
47
48 //Script 6
49 textManager.writeScript(5, 4, 0);
50 textManager.writeScript(9, 10, 0);
51 Robot.waitContinue();
52 delay(500);
53 Robot.clearScreen();
54
55 //Script 7
56 textManager.writeScript(6, 4, 0);
57 textManager.writeScript(9, 10, 0);
58 Robot.waitContinue();
59 delay(500);
60 Robot.clearScreen();
61
62 //Script 8
63 // this function enables sound and images at once
64 textManager.showPicture("init2.bmp", 0, 0);
65
66 textManager.writeScript(7, 2, 0);
67 textManager.writeScript(9, 7, 0);
68 Robot.waitContinue();
69 delay(500);
70 Robot.clearScreen();
71
72 //Script 9
73 textManager.showPicture("init3.bmp", 0, 0);
74 textManager.writeScript(8, 2, 0);
75 textManager.writeScript(9, 7, 0);
76 Robot.waitContinue();
77 delay(500);
78 Robot.clearScreen();
79
80 //Script 11
81 textManager.writeScript(10, 4, 0);
82 textManager.writeScript(9, 10, 0);
83 Robot.waitContinue();
84 delay(500);
85 Robot.clearScreen();
86
87 //Input screen
88 textManager.writeScript(0, 1, 1);
89 textManager.input(3, 1, USERNAME);
90
91 textManager.writeScript(1, 5, 1);
92 textManager.input(7, 1, ROBOTNAME);
93
94 delay(1000);
95 Robot.clearScreen();
96
97 //last screen
98 textManager.showPicture("init4.bmp", 0, 0);
99 textManager.writeText(1, 2, "Hello");
100 Robot.userNameRead(buffer);
101 textManager.writeText(3, 2, buffer);
102
103 textManager.writeScript(4, 10, 0);
104
105 Robot.waitContinue(BUTTON_LEFT);
106 Robot.waitContinue(BUTTON_RIGHT);
107 textManager.showPicture("kt1.bmp", 0, 0);
108}
109
110void loop() {
111 // do nothing here
112}
113
114
115/**
116textManager mostly contains helper functions for
117R06_Wheel_Calibration and R01_Hello_User.
118
119The ones used in this example:
120 textManager.setMargin(margin_left, margin_top):
121 Configure the left and top margin for text
122 display. The margins will be used for
123 textManager.writeText().
124 Parameters:
125 margin_left, margin_top: the margin values
126 from the top and left side of the screen.
127 Returns:
128 none
129
130 textManager.writeScript(script_number,line,column):
131 Display a script of Hello User example.
132 Parameters:
133 script_number: an int value representing the
134 script to be displayed.
135 line, column: in which line,column is the script
136 displayed. Same as writeText().
137 Returns:
138 none
139
140 textManager.input(line,column,codename):
141 Print an input indicator(">") in the line and column,
142 dispaly and receive input from a virtual keyboard,
143 and save the value into EEPROM represented by codename
144 Parameters:
145 line,column: int values represents where the input
146 starts. Same as wirteText().
147 codename: either USERNAME,ROBOTNAME,CITYNAME or
148 COUNTRYNAME. You can call Robot.userNameRead(),
149 robotNameRead(),cityNameRead() or countryNameRead()
150 to access the values later.
151 Returns:
152 none;
153
154 textManager.writeText(line,column,text):
155 Display text on the specific line and column.
156 It's different from Robot.text() as the later
157 uses pixels for positioning the text.
158 Parameters:
159 line:in which line is the text displayed. Each line
160 is 10px high.
161 column:in which column is the text displayed. Each
162 column is 8px wide.
163 text:a char array(string) of the text to be displayed.
164 Returns:
165 none
166
167 textManager.showPicture(filename, x, y):
168 It has the same functionality as Robot.drawPicture(),
169 while fixing the conflict between drawPicture() and
170 sound playing. Using Robot.drawPicture(), it'll have
171 glitches when playing sound at the same time. Using
172 showPicture(), it'll stop sound when displaying
173 picture, so preventing the problem.
174 Parameters:
175 filename:string, name of the bmp file in sd
176 x,y: int values, position of the picture
177 Returns:
178 none
179
180*/
Note: See TracBrowser for help on using the repository browser.