Rihards Balass / 4DGL-mbed-32PTU
Committer:
CaptainR
Date:
Thu Sep 15 12:40:48 2016 +0000
Revision:
18:829f3e2c064c
Parent:
16:cb072eea16e9
Child:
19:a259bc128867
read word

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