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