Rihards Balass / 4DGL-mbed-32PTU
Committer:
CaptainR
Date:
Tue Sep 27 10:45:38 2016 +0000
Revision:
23:dd2c28fa4dfd
Parent:
22:cea582ea74c1
Child:
24:19c77967674e
findFirstReturn - done :)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
CaptainR 0:a5ef6bc3c2e8 1
CaptainR 0:a5ef6bc3c2e8 2 #include "mbed.h"
CaptainR 0:a5ef6bc3c2e8 3 #include "Picaso_4DGL-32PTU.h"
CaptainR 0:a5ef6bc3c2e8 4
CaptainR 0:a5ef6bc3c2e8 5 #define SHORT_WAIT 500
CaptainR 12:29f5ad896382 6 #define LONG_WAIT 1000
CaptainR 0:a5ef6bc3c2e8 7
CaptainR 22:cea582ea74c1 8 // local declarations
CaptainR 22:cea582ea74c1 9 void clearBuf(char *);
CaptainR 20:88e137b9ea46 10
CaptainR 20:88e137b9ea46 11 //**************************************************************************
CaptainR 20:88e137b9ea46 12 // Demo program that goes through file system based functions
CaptainR 20:88e137b9ea46 13 //**************************************************************************
CaptainR 20:88e137b9ea46 14 void PICASO_4DGL :: fileSystemDemo() {
CaptainR 20:88e137b9ea46 15
CaptainR 23:dd2c28fa4dfd 16 int i;
CaptainR 20:88e137b9ea46 17 cls();
CaptainR 20:88e137b9ea46 18 screenMode(landscape); // set orientation to landscape
CaptainR 20:88e137b9ea46 19 puts("\n\rThis is the File system functions demo");
CaptainR 20:88e137b9ea46 20 wait_ms(LONG_WAIT);
CaptainR 20:88e137b9ea46 21 cls();
CaptainR 20:88e137b9ea46 22
CaptainR 22:cea582ea74c1 23 if (file_Mount()) puts("\rFAT16 Mount: OK");
CaptainR 22:cea582ea74c1 24 else puts("\rFAT16 Mount: FAIL");
CaptainR 22:cea582ea74c1 25 char buf[100];
CaptainR 22:cea582ea74c1 26 sprintf(buf, "\n\rFAT16 Error = %i", file_Error());
CaptainR 21:ea68a8a3cea4 27 puts(buf);
CaptainR 22:cea582ea74c1 28 sprintf(buf, "\n\rFile count on disc = %i\n\r", file_Count("*.*"));
CaptainR 22:cea582ea74c1 29 puts(buf);
CaptainR 22:cea582ea74c1 30 sprintf(buf, "\n\rFound %i files maching 1*.*\n", file_Dir("1*.*"));
CaptainR 22:cea582ea74c1 31 puts(buf);
CaptainR 22:cea582ea74c1 32 file_FindFirst("*.TXT");
CaptainR 23:dd2c28fa4dfd 33 char filename[FILENAME_LENGTH];
CaptainR 23:dd2c28fa4dfd 34 for (i = 0; i < FILENAME_LENGTH; i++)
CaptainR 23:dd2c28fa4dfd 35 filename[i] = 0;
CaptainR 23:dd2c28fa4dfd 36 short len = file_FindFirstRet("*.TXT", filename);
CaptainR 23:dd2c28fa4dfd 37 sprintf(buf, "\n\rFilename = %s\nLength = %i\n", filename, len);
CaptainR 23:dd2c28fa4dfd 38 puts(buf);
CaptainR 20:88e137b9ea46 39 }
CaptainR 0:a5ef6bc3c2e8 40 //**************************************************************************
CaptainR 12:29f5ad896382 41 // Demo program that goes through media based functions
CaptainR 12:29f5ad896382 42 //**************************************************************************
CaptainR 12:29f5ad896382 43 void PICASO_4DGL :: mediaDemo() {
CaptainR 12:29f5ad896382 44
CaptainR 12:29f5ad896382 45 cls();
CaptainR 12:29f5ad896382 46 screenMode(landscape); // set orientation to landscape
CaptainR 12:29f5ad896382 47 puts("\n\rThis is the Media functions demo");
CaptainR 12:29f5ad896382 48 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 49 cls();
CaptainR 12:29f5ad896382 50
CaptainR 12:29f5ad896382 51 wait_ms(SHORT_WAIT);
CaptainR 12:29f5ad896382 52 if (media_Init()) puts("\n\r uSD card Initialization: OK");
CaptainR 12:29f5ad896382 53 else puts("\n\r uSD card Initialization: FAIL");
CaptainR 14:561cb06a2739 54 if (media_SetAdd(513)) puts("\n\r Byte address set: OK");
CaptainR 14:561cb06a2739 55 else puts("\n\r Byte address set: FAIL");
CaptainR 12:29f5ad896382 56 if (media_SetSector(1)) puts("\n\r Sector address set: OK");
CaptainR 12:29f5ad896382 57 else puts("\n\r Sector address set: FAIL");
CaptainR 16:cb072eea16e9 58 /*
CaptainR 16:cb072eea16e9 59 puts("\n\r Now write some data in multiple sectors");
CaptainR 15:86bdf382e6f7 60
CaptainR 15:86bdf382e6f7 61 char array[1030];
CaptainR 15:86bdf382e6f7 62 for (int i = 0; i < 1030; i++)
CaptainR 15:86bdf382e6f7 63 array[i] = 1;
CaptainR 15:86bdf382e6f7 64
CaptainR 12:29f5ad896382 65 wait_ms(LONG_WAIT);
CaptainR 15:86bdf382e6f7 66 if (media_WrSector(array)) puts("\n\r Write Data: OK");
CaptainR 15:86bdf382e6f7 67 else puts("\n\r Write Data: FAIL");
CaptainR 14:561cb06a2739 68 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 69 puts("\n\r Now read the same data");
CaptainR 14:561cb06a2739 70 if (media_SetSector(1)) puts("\n\r Sector address set: OK");
CaptainR 15:86bdf382e6f7 71 if (media_RdSector()) puts("\n\r Read Sector 1: OK");
CaptainR 15:86bdf382e6f7 72 else puts("\n\r Read Sector 1: FAIL");
CaptainR 15:86bdf382e6f7 73 if (media_RdSector()) puts("\n\r Read Sector 2: OK");
CaptainR 15:86bdf382e6f7 74 else puts("\n\r Read Sector 2: FAIL");
CaptainR 15:86bdf382e6f7 75 if (media_RdSector()) puts("\n\r Read Sector 3: OK");
CaptainR 15:86bdf382e6f7 76 else puts("\n\r Read Sector 3: FAIL");
CaptainR 15:86bdf382e6f7 77 if (media_RdSector()) puts("\n\r Read Sector 4: OK");
CaptainR 15:86bdf382e6f7 78 else puts("\n\r Read Sector 4: FAIL");
CaptainR 15:86bdf382e6f7 79 if (media_RdSector()) puts("\n\r Read Sector 5: OK");
CaptainR 15:86bdf382e6f7 80 else puts("\n\r Read Sector 5: FAIL");
CaptainR 16:cb072eea16e9 81 */
CaptainR 16:cb072eea16e9 82 media_SetSector(1);
CaptainR 16:cb072eea16e9 83 puts("\n\r Now write some data in one sector");
CaptainR 16:cb072eea16e9 84 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 85 if (media_WrSector("Such data Much WOW")) puts("\n\r Write Data: OK");
CaptainR 16:cb072eea16e9 86 else puts("\n\r Write Data: FAIL");
CaptainR 16:cb072eea16e9 87 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 88 puts("\n\r Now read the same data");
CaptainR 16:cb072eea16e9 89 media_SetSector(1);
CaptainR 16:cb072eea16e9 90 if (media_RdSector()) {
CaptainR 16:cb072eea16e9 91 puts("\n\r Read Sector : OK");
CaptainR 16:cb072eea16e9 92 pc.printf("\n\r Data: ");
CaptainR 16:cb072eea16e9 93 for(int i = 0; i < BUFFER_SIZE; i++) pc.printf("%c", buffer[i]);
CaptainR 16:cb072eea16e9 94 pc.printf("\n\r");
CaptainR 16:cb072eea16e9 95 }
CaptainR 16:cb072eea16e9 96 else puts("\n\r Read Sector : FAIL");
CaptainR 12:29f5ad896382 97
CaptainR 16:cb072eea16e9 98 puts("\n\r Now read one byte");
CaptainR 18:829f3e2c064c 99 media_SetAdd(510);
CaptainR 16:cb072eea16e9 100 if (media_ReadByte()) puts("\n\r Read Byte : OK");
CaptainR 16:cb072eea16e9 101 else puts("\n\r Read Byte : FAIL");
CaptainR 18:829f3e2c064c 102
CaptainR 18:829f3e2c064c 103 puts("\n\r Now read one word");
CaptainR 18:829f3e2c064c 104 if (media_ReadByte()) puts("\n\r Read word : OK");
CaptainR 18:829f3e2c064c 105 else puts("\n\r Read word : FAIL");
CaptainR 19:a259bc128867 106
CaptainR 19:a259bc128867 107 puts("\n\r Now write one byte");
CaptainR 19:a259bc128867 108 media_SetSector(1);
CaptainR 19:a259bc128867 109 if (media_WriteByte('a')) puts("\n\r Write Byte : OK");
CaptainR 19:a259bc128867 110 else puts("\n\r Write Byte : FAIL");
CaptainR 20:88e137b9ea46 111 if (media_Flush()) puts("\n\r Flush : OK");
CaptainR 20:88e137b9ea46 112 else puts("\n\r Flush : FAIL");
CaptainR 20:88e137b9ea46 113
CaptainR 20:88e137b9ea46 114 puts("\n\r Now write one word (2 bytes)");
CaptainR 20:88e137b9ea46 115 //media_SetSector(1);
CaptainR 20:88e137b9ea46 116 if (media_WriteWord(19)) puts("\n\r Write Word : OK");
CaptainR 20:88e137b9ea46 117 else puts("\n\r Write Word : FAIL");
CaptainR 20:88e137b9ea46 118 if (media_Flush()) puts("\n\r Flush : OK");
CaptainR 20:88e137b9ea46 119 else puts("\n\r Flush : FAIL");
CaptainR 21:ea68a8a3cea4 120 wait_ms(LONG_WAIT);
CaptainR 19:a259bc128867 121
CaptainR 12:29f5ad896382 122 }
CaptainR 12:29f5ad896382 123 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 124 // Demo program that goes through graphics based functions
CaptainR 0:a5ef6bc3c2e8 125 //**************************************************************************
CaptainR 3:dcfbceb81fef 126 void PICASO_4DGL :: graphicsDemo() {
CaptainR 0:a5ef6bc3c2e8 127
CaptainR 12:29f5ad896382 128
CaptainR 12:29f5ad896382 129 cls();
CaptainR 11:3ebd2263f3e9 130 screenMode(landscape); // set orientation to landscape
CaptainR 0:a5ef6bc3c2e8 131 puts("This is the Graphics functions demo");
CaptainR 0:a5ef6bc3c2e8 132 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 133 cls();
CaptainR 12:29f5ad896382 134
CaptainR 11:3ebd2263f3e9 135 puts("\nLets change background color:");
CaptainR 11:3ebd2263f3e9 136 bgColor(Purple);
CaptainR 11:3ebd2263f3e9 137 cls();
CaptainR 11:3ebd2263f3e9 138 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 139 bgColor(White);
CaptainR 11:3ebd2263f3e9 140 cls();
CaptainR 11:3ebd2263f3e9 141 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 142 bgColor(Blue);
CaptainR 11:3ebd2263f3e9 143 cls();
CaptainR 11:3ebd2263f3e9 144 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 145 bgColor(Red);
CaptainR 11:3ebd2263f3e9 146 cls();
CaptainR 11:3ebd2263f3e9 147 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 148 bgColor(Aqua);
CaptainR 11:3ebd2263f3e9 149 cls();
CaptainR 11:3ebd2263f3e9 150 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 151 bgColor(Black);
CaptainR 11:3ebd2263f3e9 152 cls();
CaptainR 12:29f5ad896382 153 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 154
CaptainR 11:3ebd2263f3e9 155 puts("\nLets change contrast");
CaptainR 11:3ebd2263f3e9 156 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 157 contrast(DISABLE);
CaptainR 12:29f5ad896382 158 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 159 contrast(ENABLE);
CaptainR 12:29f5ad896382 160 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 161 cls();
CaptainR 12:29f5ad896382 162
CaptainR 11:3ebd2263f3e9 163 puts("\nLets change outline color ");
CaptainR 11:3ebd2263f3e9 164 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 165 drawFilledCircle(50, 50, 20, Red);
CaptainR 11:3ebd2263f3e9 166 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 167 outlineColor(White);
CaptainR 11:3ebd2263f3e9 168 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 169 drawFilledCircle(100, 50, 20, Red);
CaptainR 11:3ebd2263f3e9 170 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 171 cls();
CaptainR 12:29f5ad896382 172
CaptainR 0:a5ef6bc3c2e8 173 puts("\nLets change all the ");
CaptainR 2:81eaaa491a02 174 textFgColor(Purple);
CaptainR 0:a5ef6bc3c2e8 175 puts("PURPLE");
CaptainR 2:81eaaa491a02 176 textFgColor(Yellow);
CaptainR 0:a5ef6bc3c2e8 177 puts(" bits to yellow");
CaptainR 3:dcfbceb81fef 178 textFgColor(Green); // set Color back to green
CaptainR 0:a5ef6bc3c2e8 179 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 180 changeColor(Purple, Yellow);
CaptainR 0:a5ef6bc3c2e8 181 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 182 cls();
CaptainR 12:29f5ad896382 183
CaptainR 0:a5ef6bc3c2e8 184 puts("Lets draw some shapes:");
CaptainR 3:dcfbceb81fef 185 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 186 drawCircle(100, 100, 20, Aqua);
CaptainR 3:dcfbceb81fef 187 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 188 drawFilledCircle(50, 50, 20, Red);
CaptainR 3:dcfbceb81fef 189 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 190 drawLine(20, 20, 100, 30, Blue);
CaptainR 3:dcfbceb81fef 191 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 192 drawRectangle(120, 20, 200, 60, Pink);
CaptainR 3:dcfbceb81fef 193 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 194 drawFilledRectangle(210, 0, 250, 80, Orange);
CaptainR 3:dcfbceb81fef 195 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 196 short xPolyline[3] = {10, 80, 180};
CaptainR 3:dcfbceb81fef 197 short yPolyline[3] = {10, 200, 80};
CaptainR 3:dcfbceb81fef 198 drawPolyline(3, xPolyline, yPolyline, Green);
CaptainR 3:dcfbceb81fef 199 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 200 short xPolygon[5] = {0, 30, 5, 50, 40};
CaptainR 3:dcfbceb81fef 201 short yPolygon[5] = {50, 100, 220, 230, 170};
CaptainR 3:dcfbceb81fef 202 drawPolygon(5, xPolygon, yPolygon, Grey);
CaptainR 3:dcfbceb81fef 203 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 204 short xFilledPolygon[5] = {260, 280, 290, 300, 255};
CaptainR 3:dcfbceb81fef 205 short yFilledPolygon[5] = {0, 20, 35, 55, 22};
CaptainR 3:dcfbceb81fef 206 drawFilledPolygon(5, xFilledPolygon, yFilledPolygon, White);
CaptainR 3:dcfbceb81fef 207 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 208 drawTriangle(70, 130, 90, 150, 110, 120, Cream);
CaptainR 3:dcfbceb81fef 209 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 210 drawFilledTriangle(260, 50, 300, 90, 240, 120, Yellow);
CaptainR 3:dcfbceb81fef 211 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 212 drawElipse(200, 130, 20, 10, Olive);
CaptainR 10:b959bb206e6b 213 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 214 drawFilledElipse(200, 100, 30, 20, Navy);
CaptainR 12:29f5ad896382 215 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 216 linePatern(10);
CaptainR 11:3ebd2263f3e9 217 drawLine(200, 200, 100, 300, White);
CaptainR 11:3ebd2263f3e9 218 wait_ms(LONG_WAIT);
CaptainR 4:50511ed54ab4 219 cls();
CaptainR 12:29f5ad896382 220
CaptainR 6:a1a85f2bc04b 221 /*
CaptainR 6:a1a85f2bc04b 222 // somehow after this function display stops (but the calculation is right)
CaptainR 4:50511ed54ab4 223 puts("Lets calculate distance from point 0,0 on angle 40, 60 pixels away:");
CaptainR 4:50511ed54ab4 224 wait_ms(LONG_WAIT);
CaptainR 4:50511ed54ab4 225 cls();
CaptainR 4:50511ed54ab4 226 calculateOrbit(40, 60);
CaptainR 6:a1a85f2bc04b 227 wait_ms(SHORT_WAIT);
CaptainR 6:a1a85f2bc04b 228 cls();
CaptainR 6:a1a85f2bc04b 229 */
CaptainR 12:29f5ad896382 230
CaptainR 6:a1a85f2bc04b 231 puts("Lets draw some pixels:");
CaptainR 6:a1a85f2bc04b 232 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 233 cls();
CaptainR 12:29f5ad896382 234 for (int i = 0; i <= 10; i++) {
CaptainR 12:29f5ad896382 235 for (int j = 0; j <= 10; j++) {
CaptainR 12:29f5ad896382 236 putPixel(i, j, Red);
CaptainR 12:29f5ad896382 237 }
CaptainR 12:29f5ad896382 238 }
CaptainR 6:a1a85f2bc04b 239 wait_ms(LONG_WAIT);
CaptainR 6:a1a85f2bc04b 240 cls();
CaptainR 12:29f5ad896382 241
CaptainR 7:f064ae670553 242 puts("Lets move origin point:");
CaptainR 7:f064ae670553 243 wait_ms(LONG_WAIT);
CaptainR 7:f064ae670553 244 moveOrigin(100, 100);
CaptainR 7:f064ae670553 245 puts("This is the new origin!");
CaptainR 8:b634ac9c92f8 246 wait_ms(LONG_WAIT);
CaptainR 8:b634ac9c92f8 247 cls();
CaptainR 12:29f5ad896382 248
CaptainR 8:b634ac9c92f8 249 puts("Now draw line from here:");
CaptainR 8:b634ac9c92f8 250 wait_ms(SHORT_WAIT);
CaptainR 8:b634ac9c92f8 251 lineTo(100, 100);
CaptainR 12:29f5ad896382 252 wait_ms(LONG_WAIT);
CaptainR 8:b634ac9c92f8 253 puts("To here!");
CaptainR 8:b634ac9c92f8 254 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 255 cls();
CaptainR 12:29f5ad896382 256
CaptainR 9:32eb75c01e9d 257 puts("Change clipping window, to test it, we use changeColor function, that works only in clipping area:");
CaptainR 9:32eb75c01e9d 258 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 259 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 260 setClipWindow(0, 0, 200, 20);
CaptainR 9:32eb75c01e9d 261 changeColor(Green, Red);
CaptainR 9:32eb75c01e9d 262 puts("\n\n\rDone!!!!");
CaptainR 9:32eb75c01e9d 263 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 264 puts("\n\n\rNow extend to here!");
CaptainR 12:29f5ad896382 265 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 266 extendClipRegion();
CaptainR 9:32eb75c01e9d 267 changeColor(Green, Red);
CaptainR 9:32eb75c01e9d 268 puts("\n\n\rHow does it look?");
CaptainR 9:32eb75c01e9d 269 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 270 cls();
CaptainR 12:29f5ad896382 271
CaptainR 10:b959bb206e6b 272 puts("\nLets place a button:");
CaptainR 10:b959bb206e6b 273 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 274 cls();
CaptainR 12:29f5ad896382 275 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 10:b959bb206e6b 276 puts("\n\n\n\nDid it work?");
CaptainR 10:b959bb206e6b 277 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 278 cls();
CaptainR 12:29f5ad896382 279
CaptainR 11:3ebd2263f3e9 280 puts("\nNow lets change bevel width");
CaptainR 11:3ebd2263f3e9 281 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 282 if (bevelWidth(0)) {
CaptainR 11:3ebd2263f3e9 283 puts("\nNo bevel");
CaptainR 12:29f5ad896382 284 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 285 }
CaptainR 12:29f5ad896382 286 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 287 cls();
CaptainR 11:3ebd2263f3e9 288 if (bevelWidth(1)) {
CaptainR 11:3ebd2263f3e9 289 puts("\nbevel 1");
CaptainR 12:29f5ad896382 290 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 291 }
CaptainR 12:29f5ad896382 292 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 293 cls();
CaptainR 11:3ebd2263f3e9 294 if (bevelWidth(10)) {
CaptainR 11:3ebd2263f3e9 295 puts("\nbevel 10");
CaptainR 12:29f5ad896382 296 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 297 }
CaptainR 12:29f5ad896382 298 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 299 cls();
CaptainR 11:3ebd2263f3e9 300 if (bevelWidth(16)) {
CaptainR 11:3ebd2263f3e9 301 puts("\nbevel 16");
CaptainR 12:29f5ad896382 302 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 303 }
CaptainR 12:29f5ad896382 304 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 305 cls();
CaptainR 11:3ebd2263f3e9 306 if (bevelWidth(2)) {
CaptainR 11:3ebd2263f3e9 307 puts("\nbevel 2");
CaptainR 12:29f5ad896382 308 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 309 }
CaptainR 12:29f5ad896382 310 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 311 cls();
CaptainR 12:29f5ad896382 312
CaptainR 10:b959bb206e6b 313 puts("\nNow lets change bevel shadow level");
CaptainR 10:b959bb206e6b 314 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 315 if (bevelShadow(0)) {
CaptainR 11:3ebd2263f3e9 316 puts("\nNo shadow");
CaptainR 12:29f5ad896382 317 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 318 }
CaptainR 10:b959bb206e6b 319 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 320 if (bevelShadow(1)) {
CaptainR 11:3ebd2263f3e9 321 puts("\nShadow 1");
CaptainR 12:29f5ad896382 322 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 323 }
CaptainR 10:b959bb206e6b 324 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 325 if (bevelShadow(2)) {
CaptainR 11:3ebd2263f3e9 326 puts("\nShadow 2");
CaptainR 12:29f5ad896382 327 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 328 }
CaptainR 10:b959bb206e6b 329 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 330 if (bevelShadow(3)) {
CaptainR 11:3ebd2263f3e9 331 puts("\nShadow 3");
CaptainR 12:29f5ad896382 332 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 333 }
CaptainR 11:3ebd2263f3e9 334 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 335 if (bevelShadow(4)) {
CaptainR 11:3ebd2263f3e9 336 puts("\nShadow 4");
CaptainR 12:29f5ad896382 337 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 338 }
CaptainR 10:b959bb206e6b 339 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 340 if (bevelShadow(5)) {
CaptainR 11:3ebd2263f3e9 341 puts("\nShadow 5");
CaptainR 12:29f5ad896382 342 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 343 }
CaptainR 10:b959bb206e6b 344 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 345 if (bevelShadow(1)) {
CaptainR 11:3ebd2263f3e9 346 puts("\nShadow 1");
CaptainR 12:29f5ad896382 347 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 348 }
CaptainR 12:29f5ad896382 349 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 350 cls();
CaptainR 12:29f5ad896382 351
CaptainR 10:b959bb206e6b 352 puts("\nLets place a panel:");
CaptainR 10:b959bb206e6b 353 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 354 cls();
CaptainR 12:29f5ad896382 355 drawPanel(RECESSED, 0, 0, 200, 20, Cream);
CaptainR 12:29f5ad896382 356 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 357 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 358 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 359 cls();
CaptainR 12:29f5ad896382 360
CaptainR 10:b959bb206e6b 361 puts("\nLets place a slider:");
CaptainR 10:b959bb206e6b 362 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 363 cls();
CaptainR 10:b959bb206e6b 364 drawSlider(RAISED, 30, 40, 210, 90, Violet, 100, 0);
CaptainR 10:b959bb206e6b 365 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 366 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 367 cls();
CaptainR 12:29f5ad896382 368
CaptainR 10:b959bb206e6b 369 puts("\nThis particular function is going to copy a specified portion of the creen and paste it somewhere else!");
CaptainR 10:b959bb206e6b 370 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 371 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 372 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 373 //cls();
CaptainR 10:b959bb206e6b 374 screenCopyPaste(0, 0, 50, 100, 200, 50);
CaptainR 10:b959bb206e6b 375 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 376 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 377 cls();
CaptainR 12:29f5ad896382 378
CaptainR 11:3ebd2263f3e9 379 puts("\nLets get Xmax:");
CaptainR 11:3ebd2263f3e9 380 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 381 short Xmax = getGraphics(currentXMax);
CaptainR 11:3ebd2263f3e9 382 puts("\nLets get Ymax:");
CaptainR 11:3ebd2263f3e9 383 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 384 short Ymax = getGraphics(currentYMax);
CaptainR 11:3ebd2263f3e9 385 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 386 pc.printf("\nCurrent orientation xMax = %i, yMax = %i\n\r", Xmax, Ymax);
CaptainR 12:29f5ad896382 387 cls();
CaptainR 21:ea68a8a3cea4 388 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 389 }
CaptainR 0:a5ef6bc3c2e8 390
CaptainR 0:a5ef6bc3c2e8 391 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 392 // Demo program that goes through main functions
CaptainR 0:a5ef6bc3c2e8 393 //**************************************************************************
CaptainR 3:dcfbceb81fef 394 void PICASO_4DGL :: mainDemo() {
CaptainR 0:a5ef6bc3c2e8 395
CaptainR 0:a5ef6bc3c2e8 396 cls();
CaptainR 0:a5ef6bc3c2e8 397 puts("This is the main functions demo");
CaptainR 0:a5ef6bc3c2e8 398 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 399 cls();
CaptainR 12:29f5ad896382 400 /*
CaptainR 0:a5ef6bc3c2e8 401 puts("\nBaudrates:");
CaptainR 0:a5ef6bc3c2e8 402 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 403 cls();
CaptainR 12:29f5ad896382 404
CaptainR 0:a5ef6bc3c2e8 405 baudrate(4800);
CaptainR 0:a5ef6bc3c2e8 406 puts("\n4800");
CaptainR 0:a5ef6bc3c2e8 407 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 408 cls();
CaptainR 0:a5ef6bc3c2e8 409 baudrate(9600);
CaptainR 0:a5ef6bc3c2e8 410 puts("\n9600");
CaptainR 0:a5ef6bc3c2e8 411 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 412 cls();
CaptainR 0:a5ef6bc3c2e8 413 baudrate(14400);
CaptainR 0:a5ef6bc3c2e8 414 puts("\n14400");
CaptainR 0:a5ef6bc3c2e8 415 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 416 cls();
CaptainR 0:a5ef6bc3c2e8 417 baudrate(19200);
CaptainR 0:a5ef6bc3c2e8 418 puts("\n19200");
CaptainR 0:a5ef6bc3c2e8 419 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 420 cls();
CaptainR 0:a5ef6bc3c2e8 421 baudrate(38400);
CaptainR 0:a5ef6bc3c2e8 422 puts("\n38400");
CaptainR 0:a5ef6bc3c2e8 423 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 424 cls();
CaptainR 0:a5ef6bc3c2e8 425 baudrate(56000);
CaptainR 0:a5ef6bc3c2e8 426 puts("\n56000");
CaptainR 0:a5ef6bc3c2e8 427 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 428 cls();
CaptainR 0:a5ef6bc3c2e8 429 baudrate(57600);
CaptainR 0:a5ef6bc3c2e8 430 puts("\n57600");
CaptainR 0:a5ef6bc3c2e8 431 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 432 cls();
CaptainR 12:29f5ad896382 433 baudrate(9600);
CaptainR 12:29f5ad896382 434 puts("\n9600");
CaptainR 2:81eaaa491a02 435 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 436 cls();
CaptainR 12:29f5ad896382 437 */
CaptainR 0:a5ef6bc3c2e8 438 puts("\nOrientation:");
CaptainR 0:a5ef6bc3c2e8 439 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 440 cls();
CaptainR 11:3ebd2263f3e9 441 screenMode(landscape);
CaptainR 0:a5ef6bc3c2e8 442 puts("landscape");
CaptainR 0:a5ef6bc3c2e8 443 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 444 cls();
CaptainR 11:3ebd2263f3e9 445 screenMode(landscapeRew);
CaptainR 0:a5ef6bc3c2e8 446 puts("landscape rewersed");
CaptainR 0:a5ef6bc3c2e8 447 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 448 cls();
CaptainR 11:3ebd2263f3e9 449 screenMode(portrait);
CaptainR 0:a5ef6bc3c2e8 450 puts("portrait");
CaptainR 0:a5ef6bc3c2e8 451 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 452 cls();
CaptainR 11:3ebd2263f3e9 453 screenMode(portraitRew);
CaptainR 0:a5ef6bc3c2e8 454 puts("portrait rewersed");
CaptainR 0:a5ef6bc3c2e8 455 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 456 screenMode(landscape); // set back screen to landscape
CaptainR 0:a5ef6bc3c2e8 457 cls();
CaptainR 0:a5ef6bc3c2e8 458
CaptainR 0:a5ef6bc3c2e8 459 }
CaptainR 0:a5ef6bc3c2e8 460
CaptainR 0:a5ef6bc3c2e8 461 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 462 // Demo program that goes through text based functions
CaptainR 0:a5ef6bc3c2e8 463 //**************************************************************************
CaptainR 3:dcfbceb81fef 464 void PICASO_4DGL :: textDemo() {
CaptainR 0:a5ef6bc3c2e8 465
CaptainR 0:a5ef6bc3c2e8 466 cls();
CaptainR 11:3ebd2263f3e9 467 screenMode(landscape); // set screen to landscape
CaptainR 0:a5ef6bc3c2e8 468 puts("This is the Text functions demo");
CaptainR 0:a5ef6bc3c2e8 469 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 470 cls();
CaptainR 0:a5ef6bc3c2e8 471
CaptainR 0:a5ef6bc3c2e8 472 puts("\nText attributes:");
CaptainR 0:a5ef6bc3c2e8 473 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 474 //cls();
CaptainR 0:a5ef6bc3c2e8 475 puts("\n\n");
CaptainR 2:81eaaa491a02 476 textAttributes(bold);
CaptainR 0:a5ef6bc3c2e8 477 puts("\nBOLD");
CaptainR 0:a5ef6bc3c2e8 478 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 479 textAttributes(bold + italic);
CaptainR 0:a5ef6bc3c2e8 480 puts("\nBOLD & ITALIC");
CaptainR 0:a5ef6bc3c2e8 481 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 482 textAttributes(bold + italic + inverse);
CaptainR 0:a5ef6bc3c2e8 483 puts("\nBOLD & ITALIC & INVERSE");
CaptainR 0:a5ef6bc3c2e8 484 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 485 textAttributes(bold + italic + inverse + underline);
CaptainR 0:a5ef6bc3c2e8 486 puts("\nBOLD & ITALIC & INVERSE & UNDERLINE");
CaptainR 0:a5ef6bc3c2e8 487 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 488 textAttributes(DISABLE); // set everything back to normal
CaptainR 0:a5ef6bc3c2e8 489 cls();
CaptainR 0:a5ef6bc3c2e8 490
CaptainR 0:a5ef6bc3c2e8 491 puts("\nText modes:");
CaptainR 0:a5ef6bc3c2e8 492 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 493 cls();
CaptainR 2:81eaaa491a02 494 textBold(ENABLE);
CaptainR 0:a5ef6bc3c2e8 495 puts("\nBOLD:");
CaptainR 0:a5ef6bc3c2e8 496 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 497 textBold(DISABLE);
CaptainR 2:81eaaa491a02 498 textInverse(ENABLE);
CaptainR 0:a5ef6bc3c2e8 499 puts("\nINVERSE:");
CaptainR 0:a5ef6bc3c2e8 500 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 501 textInverse(DISABLE);
CaptainR 2:81eaaa491a02 502 textItalic(ENABLE);
CaptainR 0:a5ef6bc3c2e8 503 puts("\nITALIC:");
CaptainR 0:a5ef6bc3c2e8 504 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 505 textItalic(DISABLE);
CaptainR 2:81eaaa491a02 506 textUnderline(ENABLE);
CaptainR 0:a5ef6bc3c2e8 507 puts("\nUNDERLINE:");
CaptainR 0:a5ef6bc3c2e8 508 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 509 textUnderline(DISABLE);
CaptainR 0:a5ef6bc3c2e8 510 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 511 cls();
CaptainR 0:a5ef6bc3c2e8 512
CaptainR 0:a5ef6bc3c2e8 513 puts("\nText gaps:");
CaptainR 0:a5ef6bc3c2e8 514 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 515 cls();
CaptainR 0:a5ef6bc3c2e8 516 if (textXGap(0) == 1) puts("\nX gap: 0");
CaptainR 0:a5ef6bc3c2e8 517 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 518 if (textXGap(1) == 1) puts("\nX gap: 1");
CaptainR 0:a5ef6bc3c2e8 519 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 520 if (textXGap(2) == 1) puts("\nX gap: 2");
CaptainR 0:a5ef6bc3c2e8 521 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 522 if (textXGap(3) == 1) puts("\nX gap: 3");
CaptainR 0:a5ef6bc3c2e8 523 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 524 if (textXGap(4) == 1) puts("\nX gap: 4");
CaptainR 0:a5ef6bc3c2e8 525 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 526 if (textXGap(5) == 1) puts("\nX gap: 5");
CaptainR 0:a5ef6bc3c2e8 527 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 528 if (textXGap(6) == 1) puts("\nX gap: 6");
CaptainR 0:a5ef6bc3c2e8 529 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 530 puts("\n");
CaptainR 0:a5ef6bc3c2e8 531 textXGap(0);
CaptainR 0:a5ef6bc3c2e8 532 if (textYGap(0) == 1) puts("\nY gap: 0");
CaptainR 0:a5ef6bc3c2e8 533 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 534 if (textYGap(1) == 1) puts("\nY gap: 1");
CaptainR 0:a5ef6bc3c2e8 535 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 536 if (textYGap(2) == 1) puts("\nY gap: 2");
CaptainR 0:a5ef6bc3c2e8 537 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 538 if (textYGap(3) == 1) puts("\nY gap: 3");
CaptainR 0:a5ef6bc3c2e8 539 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 540 if (textYGap(4) == 1) puts("\nY gap: 4");
CaptainR 0:a5ef6bc3c2e8 541 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 542 if (textYGap(5) == 1) puts("\nY gap: 5");
CaptainR 0:a5ef6bc3c2e8 543 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 544 if (textYGap(6) == 1) puts("\nY gap: 6");
CaptainR 0:a5ef6bc3c2e8 545 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 546 textYGap(0);
CaptainR 0:a5ef6bc3c2e8 547 cls();
CaptainR 0:a5ef6bc3c2e8 548
CaptainR 0:a5ef6bc3c2e8 549 puts("Text width:");
CaptainR 0:a5ef6bc3c2e8 550 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 551 if (textWidth(1) == 1) puts("\nWidth: 1");
CaptainR 0:a5ef6bc3c2e8 552 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 553 if (textWidth(2) == 1) puts("\nWidth: 2");
CaptainR 0:a5ef6bc3c2e8 554 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 555 if (textWidth(3) == 1) puts("\nWidth: 3");
CaptainR 0:a5ef6bc3c2e8 556 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 557 if (textWidth(4) == 1) puts("\nWidth: 4");
CaptainR 0:a5ef6bc3c2e8 558 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 559 textWidth(1);
CaptainR 0:a5ef6bc3c2e8 560 puts("\nText height:");
CaptainR 0:a5ef6bc3c2e8 561 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 562 //cls();
CaptainR 0:a5ef6bc3c2e8 563 if (textHeight(1) == 1) puts("\nHeight: 1");
CaptainR 0:a5ef6bc3c2e8 564 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 565 if (textHeight(2) == 1) puts("\nHeight: 2");
CaptainR 0:a5ef6bc3c2e8 566 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 567 if (textHeight(3) == 1) puts("\nHeight: 3");
CaptainR 0:a5ef6bc3c2e8 568 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 569 if (textHeight(4) == 1) puts("\nHeight: 4");
CaptainR 0:a5ef6bc3c2e8 570 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 571 textHeight(1);
CaptainR 0:a5ef6bc3c2e8 572 cls();
CaptainR 2:81eaaa491a02 573
CaptainR 0:a5ef6bc3c2e8 574 puts("Fonts:");
CaptainR 0:a5ef6bc3c2e8 575 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 576 cls();
CaptainR 2:81eaaa491a02 577 setFont(font1);
CaptainR 0:a5ef6bc3c2e8 578 puts("\nThis is Font 1");
CaptainR 0:a5ef6bc3c2e8 579 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 580 setFont(font2);
CaptainR 0:a5ef6bc3c2e8 581 puts("\nThis is Font 2");
CaptainR 0:a5ef6bc3c2e8 582 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 583 setFont(font3);
CaptainR 0:a5ef6bc3c2e8 584 puts("\nThis is Font 3");
CaptainR 0:a5ef6bc3c2e8 585 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 586 cls();
CaptainR 0:a5ef6bc3c2e8 587
CaptainR 2:81eaaa491a02 588
CaptainR 11:3ebd2263f3e9 589 screenMode(portrait);
CaptainR 0:a5ef6bc3c2e8 590 puts("\nText Background colors:");
CaptainR 0:a5ef6bc3c2e8 591 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 592 cls();
CaptainR 2:81eaaa491a02 593 textBgColor(Black);
CaptainR 3:dcfbceb81fef 594 puts("\nBG Color = BLACK");
CaptainR 0:a5ef6bc3c2e8 595 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 596 textBgColor(Navy);
CaptainR 3:dcfbceb81fef 597 puts("\nBG Color = NAVY");
CaptainR 0:a5ef6bc3c2e8 598 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 599 textFgColor(Black);
CaptainR 2:81eaaa491a02 600 textBgColor(DGreen);
CaptainR 3:dcfbceb81fef 601 puts("\nBG Color = DARK GREEN");
CaptainR 0:a5ef6bc3c2e8 602 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 603 textBgColor(DCyan);
CaptainR 3:dcfbceb81fef 604 puts("\nBG Color = DARK CYAN");
CaptainR 0:a5ef6bc3c2e8 605 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 606 textBgColor(Purple);
CaptainR 3:dcfbceb81fef 607 puts("\nBG Color = PURPLE");
CaptainR 0:a5ef6bc3c2e8 608 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 609 textBgColor(Olive);
CaptainR 3:dcfbceb81fef 610 puts("\nBG Color = OLIVE");
CaptainR 0:a5ef6bc3c2e8 611 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 612 textBgColor(Grey);
CaptainR 3:dcfbceb81fef 613 puts("\nBG Color = GREY");
CaptainR 0:a5ef6bc3c2e8 614 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 615 textBgColor(Blue);
CaptainR 3:dcfbceb81fef 616 puts("\nBG Color = BLUE");
CaptainR 0:a5ef6bc3c2e8 617 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 618 textBgColor(Green);
CaptainR 3:dcfbceb81fef 619 puts("\nBG Color = GREEN");
CaptainR 0:a5ef6bc3c2e8 620 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 621 textBgColor(Red);
CaptainR 3:dcfbceb81fef 622 puts("\nBG Color = RED");
CaptainR 0:a5ef6bc3c2e8 623 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 624 textBgColor(Yellow);
CaptainR 3:dcfbceb81fef 625 puts("\nBG Color = YELLOW");
CaptainR 0:a5ef6bc3c2e8 626 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 627 textBgColor(GYellow);
CaptainR 3:dcfbceb81fef 628 puts("\nBG Color = GREEN YELLOW");
CaptainR 0:a5ef6bc3c2e8 629 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 630 textBgColor(White);
CaptainR 3:dcfbceb81fef 631 puts("\nBG Color = WHITE");
CaptainR 0:a5ef6bc3c2e8 632 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 633 textBgColor(Orange);
CaptainR 3:dcfbceb81fef 634 puts("\nBG Color = ORANGE");
CaptainR 0:a5ef6bc3c2e8 635 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 636 textBgColor(Pink);
CaptainR 3:dcfbceb81fef 637 puts("\nBG Color = PINK");
CaptainR 0:a5ef6bc3c2e8 638 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 639 textBgColor(Violet);
CaptainR 3:dcfbceb81fef 640 puts("\nBG Color = VIOLET");
CaptainR 0:a5ef6bc3c2e8 641 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 642 textBgColor(Aqua);
CaptainR 3:dcfbceb81fef 643 puts("\nBG Color = AQUA");
CaptainR 0:a5ef6bc3c2e8 644 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 645 textBgColor(Cream);
CaptainR 3:dcfbceb81fef 646 puts("\nBG Color = CREAM");
CaptainR 0:a5ef6bc3c2e8 647 wait_ms(LONG_WAIT);
CaptainR 3:dcfbceb81fef 648 textBgColor(Black); // set Color back
CaptainR 3:dcfbceb81fef 649 textFgColor(Green); // set Color back
CaptainR 0:a5ef6bc3c2e8 650 cls();
CaptainR 0:a5ef6bc3c2e8 651
CaptainR 12:29f5ad896382 652 screenMode(landscape);
CaptainR 0:a5ef6bc3c2e8 653 puts("Lets try moving cursor...");
CaptainR 0:a5ef6bc3c2e8 654 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 655 cls();
CaptainR 0:a5ef6bc3c2e8 656 if (moveCursor(5, 5) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 657 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 658 if (moveCursor(10, 10) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 659 wait_ms(SHORT_WAIT);
CaptainR 12:29f5ad896382 660 screenMode(portraitRew);
CaptainR 0:a5ef6bc3c2e8 661 if (moveCursor(50, 50) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 662 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 663 if (moveCursor(19, 29) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 664 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 665 cls();
CaptainR 0:a5ef6bc3c2e8 666
CaptainR 0:a5ef6bc3c2e8 667
CaptainR 11:3ebd2263f3e9 668 screenMode(portrait);
CaptainR 3:dcfbceb81fef 669 puts("\nText Foreground Colors:");
CaptainR 0:a5ef6bc3c2e8 670 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 671 cls();
CaptainR 2:81eaaa491a02 672 textBgColor(White);
CaptainR 2:81eaaa491a02 673 textFgColor(Black);
CaptainR 3:dcfbceb81fef 674 puts("\nFG Color = BLACK");
CaptainR 2:81eaaa491a02 675 textBgColor(Black);
CaptainR 0:a5ef6bc3c2e8 676 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 677 textFgColor(Navy);
CaptainR 3:dcfbceb81fef 678 puts("\nFG Color = NAVY");
CaptainR 0:a5ef6bc3c2e8 679 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 680 textFgColor(DGreen);
CaptainR 3:dcfbceb81fef 681 puts("\nFG Color = DARK GREEN");
CaptainR 0:a5ef6bc3c2e8 682 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 683 textFgColor(DCyan);
CaptainR 3:dcfbceb81fef 684 puts("\nFG Color = DARK CYAN");
CaptainR 0:a5ef6bc3c2e8 685 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 686 textFgColor(Purple);
CaptainR 3:dcfbceb81fef 687 puts("\nFG Color = PURPLE");
CaptainR 0:a5ef6bc3c2e8 688 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 689 textFgColor(Olive);
CaptainR 3:dcfbceb81fef 690 puts("\nFG Color = OLIVE");
CaptainR 0:a5ef6bc3c2e8 691 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 692 textFgColor(Grey);
CaptainR 3:dcfbceb81fef 693 puts("\nFG Color = GREY");
CaptainR 0:a5ef6bc3c2e8 694 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 695 textFgColor(Blue);
CaptainR 3:dcfbceb81fef 696 puts("\nFG Color = BLUE");
CaptainR 0:a5ef6bc3c2e8 697 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 698 textFgColor(Green);
CaptainR 3:dcfbceb81fef 699 puts("\nFG Color = GREEN");
CaptainR 0:a5ef6bc3c2e8 700 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 701 textFgColor(Red);
CaptainR 3:dcfbceb81fef 702 puts("\nFG Color = RED");
CaptainR 0:a5ef6bc3c2e8 703 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 704 textFgColor(Yellow);
CaptainR 3:dcfbceb81fef 705 puts("\nFG Color = YELLOW");
CaptainR 0:a5ef6bc3c2e8 706 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 707 textFgColor(GYellow);
CaptainR 3:dcfbceb81fef 708 puts("\nFG Color = GREEN YELLOW");
CaptainR 0:a5ef6bc3c2e8 709 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 710 textFgColor(White);
CaptainR 3:dcfbceb81fef 711 puts("\nFG Color = WHITE");
CaptainR 0:a5ef6bc3c2e8 712 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 713 textFgColor(Orange);
CaptainR 3:dcfbceb81fef 714 puts("\nFG Color = ORANGE");
CaptainR 0:a5ef6bc3c2e8 715 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 716 textFgColor(Pink);
CaptainR 3:dcfbceb81fef 717 puts("\nFG Color = PINK");
CaptainR 0:a5ef6bc3c2e8 718 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 719 textFgColor(Violet);
CaptainR 3:dcfbceb81fef 720 puts("\nFG Color = VIOLET");
CaptainR 0:a5ef6bc3c2e8 721 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 722 textFgColor(Aqua);
CaptainR 3:dcfbceb81fef 723 puts("\nFG Color = AQUA");
CaptainR 0:a5ef6bc3c2e8 724 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 725 textFgColor(Cream);
CaptainR 3:dcfbceb81fef 726 puts("\nFG Color = CREAM");
CaptainR 2:81eaaa491a02 727 wait_ms(LONG_WAIT);
CaptainR 3:dcfbceb81fef 728 textFgColor(Green); // set Color back
CaptainR 21:ea68a8a3cea4 729 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 730
CaptainR 2:81eaaa491a02 731
CaptainR 22:cea582ea74c1 732 }
CaptainR 22:cea582ea74c1 733
CaptainR 22:cea582ea74c1 734 void clearBuf(char *str) {
CaptainR 22:cea582ea74c1 735 int i;
CaptainR 22:cea582ea74c1 736 for (i = 0; i < strlen(str); i++)
CaptainR 22:cea582ea74c1 737 str[i] = 0;
CaptainR 0:a5ef6bc3c2e8 738 }