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