Only Yesterday 制御プログラム

Dependencies:   mbed FATFileSystem

Fork of OnlyYestaerday by Junichi Katsu

Committer:
jksoft
Date:
Wed Apr 02 01:43:55 2014 +0000
Revision:
0:5975af170e43
1st Prototype

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:5975af170e43 1 /* Sample code for mbed eDISP Library
jksoft 0:5975af170e43 2 * Copyright (c) 2010 todotani
jksoft 0:5975af170e43 3 * Released under the MIT License: http://mbed.org/license/mit
jksoft 0:5975af170e43 4 */
jksoft 0:5975af170e43 5
jksoft 0:5975af170e43 6 #include "mbed.h"
jksoft 0:5975af170e43 7 #include "eDisp.h"
jksoft 0:5975af170e43 8 #include "SDFileSystem.h"
jksoft 0:5975af170e43 9 #include "wave_player.h"
jksoft 0:5975af170e43 10 #include "LEDStrip.h"
jksoft 0:5975af170e43 11
jksoft 0:5975af170e43 12 #define LED_NUM 16
jksoft 0:5975af170e43 13 #define LED_DATA_NUM 3
jksoft 0:5975af170e43 14
jksoft 0:5975af170e43 15 AnalogIn sensor(p20);
jksoft 0:5975af170e43 16 Serial pc(USBTX, USBRX); // tx, rx
jksoft 0:5975af170e43 17 SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card
jksoft 0:5975af170e43 18 AnalogOut DACout(p18);
jksoft 0:5975af170e43 19 wave_player waver(&DACout);
jksoft 0:5975af170e43 20 Serial tempe(p9, p10); // tx, rx
jksoft 0:5975af170e43 21 DigitalOut led1(LED1);
jksoft 0:5975af170e43 22 DigitalOut led2(LED2);
jksoft 0:5975af170e43 23
jksoft 0:5975af170e43 24 unsigned char led_data[LED_NUM][3];
jksoft 0:5975af170e43 25
jksoft 0:5975af170e43 26 float ss;
jksoft 0:5975af170e43 27 int sensor_on_f = 0;
jksoft 0:5975af170e43 28
jksoft 0:5975af170e43 29
jksoft 0:5975af170e43 30 // RGB color code table
jksoft 0:5975af170e43 31 int RGB_color[16] = {
jksoft 0:5975af170e43 32 RGB_Navy,
jksoft 0:5975af170e43 33 RGB_Silver,
jksoft 0:5975af170e43 34 RGB_Blue,
jksoft 0:5975af170e43 35 RGB_Maroon,
jksoft 0:5975af170e43 36 RGB_Purple,
jksoft 0:5975af170e43 37 RGB_Red,
jksoft 0:5975af170e43 38 RGB_Fuchsia,
jksoft 0:5975af170e43 39 RGB_Green,
jksoft 0:5975af170e43 40 RGB_Teal,
jksoft 0:5975af170e43 41 RGB_Lime,
jksoft 0:5975af170e43 42 RGB_Aqua,
jksoft 0:5975af170e43 43 RGB_Olive,
jksoft 0:5975af170e43 44 RGB_Gray,
jksoft 0:5975af170e43 45 RGB_Yellow,
jksoft 0:5975af170e43 46 RGB_White,
jksoft 0:5975af170e43 47 RGB_Black };
jksoft 0:5975af170e43 48
jksoft 0:5975af170e43 49 // RGB color name table
jksoft 0:5975af170e43 50 char* colorName[16] = {
jksoft 0:5975af170e43 51 "Navy",
jksoft 0:5975af170e43 52 "Silver",
jksoft 0:5975af170e43 53 "Blue",
jksoft 0:5975af170e43 54 "Maroon",
jksoft 0:5975af170e43 55 "Purple",
jksoft 0:5975af170e43 56 "Red",
jksoft 0:5975af170e43 57 "Fuchsia",
jksoft 0:5975af170e43 58 "Green",
jksoft 0:5975af170e43 59 "Teal",
jksoft 0:5975af170e43 60 "Lime",
jksoft 0:5975af170e43 61 "Aqua",
jksoft 0:5975af170e43 62 "Olive",
jksoft 0:5975af170e43 63 "Gray",
jksoft 0:5975af170e43 64 "Yellow",
jksoft 0:5975af170e43 65 "White",
jksoft 0:5975af170e43 66 "Black" };
jksoft 0:5975af170e43 67
jksoft 0:5975af170e43 68
jksoft 0:5975af170e43 69 const unsigned char _RED[3] = { 0xFF, 0 , 0 };
jksoft 0:5975af170e43 70 const unsigned char _ORENGE[3] = { 0xFF, 0x8F , 0 };
jksoft 0:5975af170e43 71 const unsigned char _ORENGE1[3] = { 0xAF, 0x8F , 0 };
jksoft 0:5975af170e43 72 const unsigned char _GEN[3] = { 0xFF, 0x8F , 0x8F };
jksoft 0:5975af170e43 73 const unsigned char _GREEN[3] = { 0 , 0xFF, 0 };
jksoft 0:5975af170e43 74 const unsigned char _BLUE[3] = { 0 , 0 , 0xFF };
jksoft 0:5975af170e43 75 const unsigned char _YELLOW[3] = { 0xFF, 0xFF, 0 };
jksoft 0:5975af170e43 76 const unsigned char _PURPLE[3] = { 0xFF, 0 , 0xFF };
jksoft 0:5975af170e43 77 const unsigned char _AQUA[3] = { 0 , 0xFF, 0xFF };
jksoft 0:5975af170e43 78 const unsigned char _WHITE[3] = { 0xFF, 0xFF, 0xFF };
jksoft 0:5975af170e43 79 const unsigned char _GLAY[3] = { 0x80, 0x80, 0x80 };
jksoft 0:5975af170e43 80 const unsigned char _OFF[3] = { 0, 0, 0 };
jksoft 0:5975af170e43 81
jksoft 0:5975af170e43 82 unsigned char _todat[3];
jksoft 0:5975af170e43 83
jksoft 0:5975af170e43 84 eDisp display(p28, p27, 115200); // tx, rx, baud
jksoft 0:5975af170e43 85 Ticker flipper;
jksoft 0:5975af170e43 86 Ticker flipper1;
jksoft 0:5975af170e43 87 extern int sound_stop;
jksoft 0:5975af170e43 88 int ni_end = 0;
jksoft 0:5975af170e43 89
jksoft 0:5975af170e43 90 #define MAX_PHOTONO 10
jksoft 0:5975af170e43 91
jksoft 0:5975af170e43 92 void send_led()
jksoft 0:5975af170e43 93 {
jksoft 0:5975af170e43 94 for(int i=0;i<LED_NUM;i++)
jksoft 0:5975af170e43 95 {
jksoft 0:5975af170e43 96 tapeSet(i,led_data[i][0] << 16 | led_data[i][1] << 8 | led_data[i][2]);
jksoft 0:5975af170e43 97 }
jksoft 0:5975af170e43 98 tapeSend();
jksoft 0:5975af170e43 99 }
jksoft 0:5975af170e43 100
jksoft 0:5975af170e43 101 void send_led2()
jksoft 0:5975af170e43 102 {
jksoft 0:5975af170e43 103 static int i = 0;
jksoft 0:5975af170e43 104
jksoft 0:5975af170e43 105 tapeSet(i,led_data[i][0] << 16 | led_data[i][1] << 8 | led_data[i][2]);
jksoft 0:5975af170e43 106 i++;
jksoft 0:5975af170e43 107 if( i >= LED_NUM )
jksoft 0:5975af170e43 108 {
jksoft 0:5975af170e43 109 i = 0;
jksoft 0:5975af170e43 110 tapeSend();
jksoft 0:5975af170e43 111 }
jksoft 0:5975af170e43 112 }
jksoft 0:5975af170e43 113
jksoft 0:5975af170e43 114
jksoft 0:5975af170e43 115 void voice(char* file_path)
jksoft 0:5975af170e43 116 {
jksoft 0:5975af170e43 117 FILE *wave_file;
jksoft 0:5975af170e43 118
jksoft 0:5975af170e43 119 wave_file=fopen(file_path,"r");
jksoft 0:5975af170e43 120 waver.play(wave_file);
jksoft 0:5975af170e43 121 fclose(wave_file);
jksoft 0:5975af170e43 122 }
jksoft 0:5975af170e43 123
jksoft 0:5975af170e43 124 // color 0~100 weather 0:sun 1:ran 2: cloude
jksoft 0:5975af170e43 125 void tempescope( int color , int weather , int lightning )
jksoft 0:5975af170e43 126 {
jksoft 0:5975af170e43 127 pc.printf("Zr,%d,%d,%d\n\r",color,weather,lightning);
jksoft 0:5975af170e43 128 // for(int i = 0 ; i < 10 ; i++ )
jksoft 0:5975af170e43 129 // {
jksoft 0:5975af170e43 130 tempe.printf("Zr,%d,%d,%d\r\n",color,weather,lightning);
jksoft 0:5975af170e43 131 // wait(0.1);
jksoft 0:5975af170e43 132 // }
jksoft 0:5975af170e43 133 }
jksoft 0:5975af170e43 134
jksoft 0:5975af170e43 135 void flip() {
jksoft 0:5975af170e43 136 ss = sensor;
jksoft 0:5975af170e43 137
jksoft 0:5975af170e43 138 if( ss > 0.2 )
jksoft 0:5975af170e43 139 {
jksoft 0:5975af170e43 140 if( sensor_on_f == 0 )
jksoft 0:5975af170e43 141 {
jksoft 0:5975af170e43 142 waver.set_s_stop();
jksoft 0:5975af170e43 143 led2 = 1;
jksoft 0:5975af170e43 144 sensor_on_f = 1;
jksoft 0:5975af170e43 145 }
jksoft 0:5975af170e43 146 }
jksoft 0:5975af170e43 147 else
jksoft 0:5975af170e43 148 {
jksoft 0:5975af170e43 149 sensor_on_f = 0;
jksoft 0:5975af170e43 150 }
jksoft 0:5975af170e43 151 led1 = !led1;
jksoft 0:5975af170e43 152 //send_led();
jksoft 0:5975af170e43 153
jksoft 0:5975af170e43 154 }
jksoft 0:5975af170e43 155
jksoft 0:5975af170e43 156 int near(unsigned char *from_dat,const unsigned char *to_dat,int wide)
jksoft 0:5975af170e43 157 {
jksoft 0:5975af170e43 158 int ret_code_l = 1;
jksoft 0:5975af170e43 159
jksoft 0:5975af170e43 160 for( int i=0;i<LED_DATA_NUM;i++)
jksoft 0:5975af170e43 161 {
jksoft 0:5975af170e43 162 if( from_dat[i] < to_dat[i] )
jksoft 0:5975af170e43 163 {
jksoft 0:5975af170e43 164 if( (from_dat[i]+wide) < to_dat[i] )
jksoft 0:5975af170e43 165 {
jksoft 0:5975af170e43 166 from_dat[i] = from_dat[i] + wide;
jksoft 0:5975af170e43 167 ret_code_l = 0;
jksoft 0:5975af170e43 168 }
jksoft 0:5975af170e43 169 else
jksoft 0:5975af170e43 170 {
jksoft 0:5975af170e43 171 from_dat[i] = to_dat[i];
jksoft 0:5975af170e43 172
jksoft 0:5975af170e43 173 }
jksoft 0:5975af170e43 174 }
jksoft 0:5975af170e43 175 else if( from_dat[i] > to_dat[i] )
jksoft 0:5975af170e43 176 {
jksoft 0:5975af170e43 177 if( (from_dat[i]-wide) > to_dat[i])
jksoft 0:5975af170e43 178 {
jksoft 0:5975af170e43 179 from_dat[i] -= wide;
jksoft 0:5975af170e43 180 ret_code_l = 0;
jksoft 0:5975af170e43 181 }
jksoft 0:5975af170e43 182 else
jksoft 0:5975af170e43 183 {
jksoft 0:5975af170e43 184 from_dat[i] = to_dat[i];
jksoft 0:5975af170e43 185 }
jksoft 0:5975af170e43 186 }
jksoft 0:5975af170e43 187 }
jksoft 0:5975af170e43 188
jksoft 0:5975af170e43 189 return(ret_code_l);
jksoft 0:5975af170e43 190 }
jksoft 0:5975af170e43 191
jksoft 0:5975af170e43 192 void flip2() {
jksoft 0:5975af170e43 193 ni_end = 0;
jksoft 0:5975af170e43 194
jksoft 0:5975af170e43 195 for(int j=0;j<LED_NUM;j++)
jksoft 0:5975af170e43 196 {
jksoft 0:5975af170e43 197 ni_end += near( led_data[j] , _todat , 10 );
jksoft 0:5975af170e43 198 }
jksoft 0:5975af170e43 199 }
jksoft 0:5975af170e43 200
jksoft 0:5975af170e43 201 void slow_light_all(const unsigned char *base_dat,int speed)
jksoft 0:5975af170e43 202 {
jksoft 0:5975af170e43 203 int i,j;
jksoft 0:5975af170e43 204 while(i!=LED_NUM)
jksoft 0:5975af170e43 205 {
jksoft 0:5975af170e43 206 i = 0;
jksoft 0:5975af170e43 207 for(j=0;j<LED_NUM;j++)
jksoft 0:5975af170e43 208 {
jksoft 0:5975af170e43 209 i += near( led_data[j] , base_dat , 5 );
jksoft 0:5975af170e43 210 }
jksoft 0:5975af170e43 211 send_led();
jksoft 0:5975af170e43 212 wait_ms(speed);
jksoft 0:5975af170e43 213 }
jksoft 0:5975af170e43 214 }
jksoft 0:5975af170e43 215
jksoft 0:5975af170e43 216 int main() {
jksoft 0:5975af170e43 217 int i;
jksoft 0:5975af170e43 218 int photo_no = 0;
jksoft 0:5975af170e43 219 int old_photo_no = 1;
jksoft 0:5975af170e43 220
jksoft 0:5975af170e43 221 wait(2);
jksoft 0:5975af170e43 222
jksoft 0:5975af170e43 223 //tempescope( 100 , 1 , 0 );
jksoft 0:5975af170e43 224
jksoft 0:5975af170e43 225 for(int i=0;i<LED_NUM;i++)
jksoft 0:5975af170e43 226 {
jksoft 0:5975af170e43 227 memcpy( &led_data[i][0] , &_WHITE[0] , LED_DATA_NUM );
jksoft 0:5975af170e43 228 // for(int j=0;j<LED_DATA_NUM;j++)
jksoft 0:5975af170e43 229 // {
jksoft 0:5975af170e43 230 // led_data[i][j] = _AQUA;
jksoft 0:5975af170e43 231 // }
jksoft 0:5975af170e43 232 }
jksoft 0:5975af170e43 233
jksoft 0:5975af170e43 234 tapeInit(0, LED_NUM);
jksoft 0:5975af170e43 235
jksoft 0:5975af170e43 236 // slow_light_all(_AQUA , 100);
jksoft 0:5975af170e43 237
jksoft 0:5975af170e43 238 memcpy( _todat , _AQUA , 3);
jksoft 0:5975af170e43 239
jksoft 0:5975af170e43 240 wait(2);
jksoft 0:5975af170e43 241
jksoft 0:5975af170e43 242 send_led();
jksoft 0:5975af170e43 243
jksoft 0:5975af170e43 244 display.pic(0,1);
jksoft 0:5975af170e43 245 wait(1.0);
jksoft 0:5975af170e43 246 display.pic(1,2);
jksoft 0:5975af170e43 247 wait(1.0);
jksoft 0:5975af170e43 248 display.pic(2,3);
jksoft 0:5975af170e43 249 wait(1.0);
jksoft 0:5975af170e43 250 display.pic(3,4);
jksoft 0:5975af170e43 251 wait(1.0);
jksoft 0:5975af170e43 252 flipper1.attach(&flip2, 0.1);
jksoft 0:5975af170e43 253
jksoft 0:5975af170e43 254 while(1)
jksoft 0:5975af170e43 255 {
jksoft 0:5975af170e43 256 ss = sensor;
jksoft 0:5975af170e43 257 pc.printf("sensor:%f\r\n",ss);
jksoft 0:5975af170e43 258
jksoft 0:5975af170e43 259 if( old_photo_no != photo_no )
jksoft 0:5975af170e43 260 {
jksoft 0:5975af170e43 261 display.pic(0,photo_no+1);
jksoft 0:5975af170e43 262 while(ni_end!=LED_NUM)
jksoft 0:5975af170e43 263 {
jksoft 0:5975af170e43 264 send_led();
jksoft 0:5975af170e43 265 }
jksoft 0:5975af170e43 266 flipper1.detach();
jksoft 0:5975af170e43 267 old_photo_no = photo_no;
jksoft 0:5975af170e43 268 display.chg_buff(0);
jksoft 0:5975af170e43 269 flipper.attach(&flip, 0.1);
jksoft 0:5975af170e43 270 switch( photo_no )
jksoft 0:5975af170e43 271 {
jksoft 0:5975af170e43 272 case 0:
jksoft 0:5975af170e43 273 voice("/sd/1.wav");
jksoft 0:5975af170e43 274 break;
jksoft 0:5975af170e43 275 case 1:
jksoft 0:5975af170e43 276 voice("/sd/2.wav");
jksoft 0:5975af170e43 277 break;
jksoft 0:5975af170e43 278 case 2:
jksoft 0:5975af170e43 279 voice("/sd/3.wav");
jksoft 0:5975af170e43 280 break;
jksoft 0:5975af170e43 281 case 3:
jksoft 0:5975af170e43 282 voice("/sd/4.wav");
jksoft 0:5975af170e43 283 break;
jksoft 0:5975af170e43 284 case 4:
jksoft 0:5975af170e43 285 voice("/sd/5.wav");
jksoft 0:5975af170e43 286 break;
jksoft 0:5975af170e43 287 case 5:
jksoft 0:5975af170e43 288 voice("/sd/6.wav");
jksoft 0:5975af170e43 289 break;
jksoft 0:5975af170e43 290 case 6:
jksoft 0:5975af170e43 291 voice("/sd/7.wav");
jksoft 0:5975af170e43 292 break;
jksoft 0:5975af170e43 293 case 7:
jksoft 0:5975af170e43 294 voice("/sd/8.wav");
jksoft 0:5975af170e43 295 break;
jksoft 0:5975af170e43 296 case 8:
jksoft 0:5975af170e43 297 voice("/sd/9.wav");
jksoft 0:5975af170e43 298 break;
jksoft 0:5975af170e43 299 case 9:
jksoft 0:5975af170e43 300 voice("/sd/10.wav");
jksoft 0:5975af170e43 301 break;
jksoft 0:5975af170e43 302 }
jksoft 0:5975af170e43 303
jksoft 0:5975af170e43 304 flipper.detach();
jksoft 0:5975af170e43 305 led2 = 0;
jksoft 0:5975af170e43 306 sensor_on_f = 0;
jksoft 0:5975af170e43 307 flipper1.attach(&flip2, 0.1);
jksoft 0:5975af170e43 308 }
jksoft 0:5975af170e43 309
jksoft 0:5975af170e43 310 if( ss > 0.2 )
jksoft 0:5975af170e43 311 {
jksoft 0:5975af170e43 312 if( sensor_on_f == 0 )
jksoft 0:5975af170e43 313 {
jksoft 0:5975af170e43 314 photo_no++;
jksoft 0:5975af170e43 315 if( photo_no >= MAX_PHOTONO )
jksoft 0:5975af170e43 316 {
jksoft 0:5975af170e43 317 photo_no = 0;
jksoft 0:5975af170e43 318 }
jksoft 0:5975af170e43 319 switch( photo_no )
jksoft 0:5975af170e43 320 {
jksoft 0:5975af170e43 321 case 0:
jksoft 0:5975af170e43 322 memcpy( _todat , _WHITE , 3);
jksoft 0:5975af170e43 323 tempescope( 23 , 2 , 0 );
jksoft 0:5975af170e43 324 break;
jksoft 0:5975af170e43 325 case 1:
jksoft 0:5975af170e43 326 memcpy( _todat , _ORENGE , 3);
jksoft 0:5975af170e43 327 tempescope( 0 , 2 , 0 );
jksoft 0:5975af170e43 328 break;
jksoft 0:5975af170e43 329 case 2:
jksoft 0:5975af170e43 330 memcpy( _todat , _ORENGE1 , 3);
jksoft 0:5975af170e43 331 tempescope( 100 , 0 , 0 );
jksoft 0:5975af170e43 332 break;
jksoft 0:5975af170e43 333 case 3:
jksoft 0:5975af170e43 334 memcpy( _todat , _BLUE , 3);
jksoft 0:5975af170e43 335 tempescope( 70 , 1 , 0 );
jksoft 0:5975af170e43 336 break;
jksoft 0:5975af170e43 337 case 4:
jksoft 0:5975af170e43 338 memcpy( _todat , _ORENGE , 3);
jksoft 0:5975af170e43 339 tempescope( 50 , 0 , 0 );
jksoft 0:5975af170e43 340 break;
jksoft 0:5975af170e43 341 case 5:
jksoft 0:5975af170e43 342 memcpy( _todat , _GLAY, 3);
jksoft 0:5975af170e43 343 tempescope( 0 , 0 , 0 );
jksoft 0:5975af170e43 344 break;
jksoft 0:5975af170e43 345 case 6:
jksoft 0:5975af170e43 346 memcpy( _todat , _AQUA , 3);
jksoft 0:5975af170e43 347 tempescope( 100 , 0 , 0 );
jksoft 0:5975af170e43 348 break;
jksoft 0:5975af170e43 349 case 7:
jksoft 0:5975af170e43 350 memcpy( _todat , _OFF , 3);
jksoft 0:5975af170e43 351 tempescope( 0 , 1 , 1 );
jksoft 0:5975af170e43 352 break;
jksoft 0:5975af170e43 353 case 8:
jksoft 0:5975af170e43 354 memcpy( _todat , _ORENGE , 3);
jksoft 0:5975af170e43 355 tempescope( 10 , 2 , 0 );
jksoft 0:5975af170e43 356 break;
jksoft 0:5975af170e43 357 case 9:
jksoft 0:5975af170e43 358 memcpy( _todat , _RED , 3);
jksoft 0:5975af170e43 359 tempescope( 100 , 0 , 0 );
jksoft 0:5975af170e43 360 break;
jksoft 0:5975af170e43 361 }
jksoft 0:5975af170e43 362
jksoft 0:5975af170e43 363 }
jksoft 0:5975af170e43 364 sensor_on_f = 1;
jksoft 0:5975af170e43 365 }
jksoft 0:5975af170e43 366 else
jksoft 0:5975af170e43 367 {
jksoft 0:5975af170e43 368 sensor_on_f = 0;
jksoft 0:5975af170e43 369 }
jksoft 0:5975af170e43 370 send_led();
jksoft 0:5975af170e43 371 wait(0.1);
jksoft 0:5975af170e43 372 }
jksoft 0:5975af170e43 373
jksoft 0:5975af170e43 374 #if 1
jksoft 0:5975af170e43 375 wait(2);
jksoft 0:5975af170e43 376
jksoft 0:5975af170e43 377 display.pic(0,1);
jksoft 0:5975af170e43 378 wait(1.0);
jksoft 0:5975af170e43 379 display.pic(1,2);
jksoft 0:5975af170e43 380 wait(1.0);
jksoft 0:5975af170e43 381
jksoft 0:5975af170e43 382 while(1)
jksoft 0:5975af170e43 383 {
jksoft 0:5975af170e43 384 display.chg_buff(0);
jksoft 0:5975af170e43 385 wait(1.0);
jksoft 0:5975af170e43 386 display.chg_buff(1);
jksoft 0:5975af170e43 387 wait(1.0);
jksoft 0:5975af170e43 388 }
jksoft 0:5975af170e43 389
jksoft 0:5975af170e43 390 while(1);
jksoft 0:5975af170e43 391 #endif
jksoft 0:5975af170e43 392
jksoft 0:5975af170e43 393 while (1) {
jksoft 0:5975af170e43 394 // Test-1
jksoft 0:5975af170e43 395 // clear graphics screen
jksoft 0:5975af170e43 396 display.fillRect(0, 320, 240, 0, 0, RGB_Black);
jksoft 0:5975af170e43 397 display.reset();
jksoft 0:5975af170e43 398 for (i = 0; i < 15; i++) {
jksoft 0:5975af170e43 399 display.fillRect(0, 320, 16, 0, i*16, RGB_color[i]);
jksoft 0:5975af170e43 400 display.locate(0, i);
jksoft 0:5975af170e43 401 display.printf("%s", colorName[i] );
jksoft 0:5975af170e43 402 }
jksoft 0:5975af170e43 403 wait(2);
jksoft 0:5975af170e43 404
jksoft 0:5975af170e43 405 // Test-2
jksoft 0:5975af170e43 406 display.fillRect(0, 320, 240, 0, 0, RGB_Black);
jksoft 0:5975af170e43 407 display.cls();
jksoft 0:5975af170e43 408 for (i = 0; i < 15; i++) {
jksoft 0:5975af170e43 409 display.drawLine(0, 1, i*16+1, 319, i*16+1, RGB_color[i]);
jksoft 0:5975af170e43 410 display.drawLine(0, i*21+1, 0, i*21+1, 239, RGB_color[i]);
jksoft 0:5975af170e43 411 }
jksoft 0:5975af170e43 412 wait(2);
jksoft 0:5975af170e43 413
jksoft 0:5975af170e43 414 // Test-3
jksoft 0:5975af170e43 415 for (i = 0; i < 15; i++) {
jksoft 0:5975af170e43 416 display.fillRect(0, 320, 240, 0, 0, RGB_color[i]);
jksoft 0:5975af170e43 417 wait(0.2); // wait until completion of draw
jksoft 0:5975af170e43 418 }
jksoft 0:5975af170e43 419 wait(2);
jksoft 0:5975af170e43 420
jksoft 0:5975af170e43 421 // Test-4
jksoft 0:5975af170e43 422 display.fillRect(0, 320, 240, 0, 0, RGB_Black);
jksoft 0:5975af170e43 423 display.cls();
jksoft 0:5975af170e43 424 for (i = 0; i < 15; i++) {
jksoft 0:5975af170e43 425 display.textColor(RED + i%7);
jksoft 0:5975af170e43 426 display.printf("�����\��OK �`A�aB�bC\n");
jksoft 0:5975af170e43 427 }
jksoft 0:5975af170e43 428 wait(2);
jksoft 0:5975af170e43 429 }
jksoft 0:5975af170e43 430 }