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