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@9:32eb75c01e9d, 2016-09-12 (annotated)
- Committer:
- CaptainR
- Date:
- Mon Sep 12 12:48:47 2016 +0000
- Revision:
- 9:32eb75c01e9d
- Parent:
- 8:b634ac9c92f8
- Child:
- 10:b959bb206e6b
setClipWindow(), clipping(), extendClipRegion()
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 | 2:81eaaa491a02 | 14 | screenOrientation(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 | 0:a5ef6bc3c2e8 | 19 | puts("\nLets change all the "); |
CaptainR | 2:81eaaa491a02 | 20 | textFgColor(Purple); |
CaptainR | 0:a5ef6bc3c2e8 | 21 | puts("PURPLE"); |
CaptainR | 2:81eaaa491a02 | 22 | textFgColor(Yellow); |
CaptainR | 0:a5ef6bc3c2e8 | 23 | puts(" bits to yellow"); |
CaptainR | 3:dcfbceb81fef | 24 | textFgColor(Green); // set Color back to green |
CaptainR | 0:a5ef6bc3c2e8 | 25 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 26 | changeColor(Purple, Yellow); |
CaptainR | 0:a5ef6bc3c2e8 | 27 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 28 | cls(); |
CaptainR | 7:f064ae670553 | 29 | */ |
CaptainR | 7:f064ae670553 | 30 | /* |
CaptainR | 0:a5ef6bc3c2e8 | 31 | puts("Lets draw some shapes:"); |
CaptainR | 3:dcfbceb81fef | 32 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 33 | drawCircle(100, 100, 20, Aqua); |
CaptainR | 3:dcfbceb81fef | 34 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 35 | drawFilledCircle(50, 50, 20, Red); |
CaptainR | 3:dcfbceb81fef | 36 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 37 | drawLine(20, 20, 100, 30, Blue); |
CaptainR | 3:dcfbceb81fef | 38 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 39 | drawRectangle(120, 20, 200, 60, Pink); |
CaptainR | 3:dcfbceb81fef | 40 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 41 | drawFilledRectangle(210, 0, 250, 80, Orange); |
CaptainR | 3:dcfbceb81fef | 42 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 43 | short xPolyline[3] = {10, 80, 180}; |
CaptainR | 3:dcfbceb81fef | 44 | short yPolyline[3] = {10, 200, 80}; |
CaptainR | 3:dcfbceb81fef | 45 | drawPolyline(3, xPolyline, yPolyline, Green); |
CaptainR | 3:dcfbceb81fef | 46 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 47 | short xPolygon[5] = {0, 30, 5, 50, 40}; |
CaptainR | 3:dcfbceb81fef | 48 | short yPolygon[5] = {50, 100, 220, 230, 170}; |
CaptainR | 3:dcfbceb81fef | 49 | drawPolygon(5, xPolygon, yPolygon, Grey); |
CaptainR | 3:dcfbceb81fef | 50 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 51 | short xFilledPolygon[5] = {260, 280, 290, 300, 255}; |
CaptainR | 3:dcfbceb81fef | 52 | short yFilledPolygon[5] = {0, 20, 35, 55, 22}; |
CaptainR | 3:dcfbceb81fef | 53 | drawFilledPolygon(5, xFilledPolygon, yFilledPolygon, White); |
CaptainR | 3:dcfbceb81fef | 54 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 55 | drawTriangle(70, 130, 90, 150, 110, 120, Cream); |
CaptainR | 3:dcfbceb81fef | 56 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 57 | drawFilledTriangle(260, 50, 300, 90, 240, 120, Yellow); |
CaptainR | 3:dcfbceb81fef | 58 | wait_ms(SHORT_WAIT); |
CaptainR | 4:50511ed54ab4 | 59 | cls(); |
CaptainR | 7:f064ae670553 | 60 | */ |
CaptainR | 6:a1a85f2bc04b | 61 | /* |
CaptainR | 6:a1a85f2bc04b | 62 | // somehow after this function display stops (but the calculation is right) |
CaptainR | 4:50511ed54ab4 | 63 | puts("Lets calculate distance from point 0,0 on angle 40, 60 pixels away:"); |
CaptainR | 4:50511ed54ab4 | 64 | wait_ms(LONG_WAIT); |
CaptainR | 4:50511ed54ab4 | 65 | cls(); |
CaptainR | 4:50511ed54ab4 | 66 | calculateOrbit(40, 60); |
CaptainR | 6:a1a85f2bc04b | 67 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 68 | cls(); |
CaptainR | 6:a1a85f2bc04b | 69 | */ |
CaptainR | 8:b634ac9c92f8 | 70 | /* |
CaptainR | 6:a1a85f2bc04b | 71 | puts("Lets draw some pixels:"); |
CaptainR | 6:a1a85f2bc04b | 72 | wait_ms(LONG_WAIT); |
CaptainR | 6:a1a85f2bc04b | 73 | putPixel(15, 15, White); |
CaptainR | 6:a1a85f2bc04b | 74 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 75 | putPixel(20, 20, Red); |
CaptainR | 6:a1a85f2bc04b | 76 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 77 | putPixel(25, 25, Green); |
CaptainR | 6:a1a85f2bc04b | 78 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 79 | putPixel(30, 30, Blue); |
CaptainR | 6:a1a85f2bc04b | 80 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 81 | putPixel(35, 35, Aqua); |
CaptainR | 6:a1a85f2bc04b | 82 | wait_ms(LONG_WAIT); |
CaptainR | 6:a1a85f2bc04b | 83 | cls(); |
CaptainR | 8:b634ac9c92f8 | 84 | */ |
CaptainR | 8:b634ac9c92f8 | 85 | /* |
CaptainR | 7:f064ae670553 | 86 | puts("Lets move origin point:"); |
CaptainR | 7:f064ae670553 | 87 | wait_ms(LONG_WAIT); |
CaptainR | 7:f064ae670553 | 88 | moveOrigin(100, 100); |
CaptainR | 7:f064ae670553 | 89 | puts("This is the new origin!"); |
CaptainR | 8:b634ac9c92f8 | 90 | wait_ms(LONG_WAIT); |
CaptainR | 8:b634ac9c92f8 | 91 | cls(); |
CaptainR | 8:b634ac9c92f8 | 92 | */ |
CaptainR | 9:32eb75c01e9d | 93 | /* |
CaptainR | 8:b634ac9c92f8 | 94 | puts("Now draw line from here:"); |
CaptainR | 8:b634ac9c92f8 | 95 | wait_ms(SHORT_WAIT); |
CaptainR | 8:b634ac9c92f8 | 96 | lineTo(100, 100); |
CaptainR | 8:b634ac9c92f8 | 97 | wait_ms(SHORT_WAIT); |
CaptainR | 8:b634ac9c92f8 | 98 | puts("To here!"); |
CaptainR | 8:b634ac9c92f8 | 99 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 100 | cls(); |
CaptainR | 9:32eb75c01e9d | 101 | */ |
CaptainR | 9:32eb75c01e9d | 102 | |
CaptainR | 9:32eb75c01e9d | 103 | puts("Change clipping window, to test it, we use changeColor function, that works only in clipping area:"); |
CaptainR | 9:32eb75c01e9d | 104 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 105 | setClipWindow(0, 0, 200, 20); |
CaptainR | 9:32eb75c01e9d | 106 | changeColor(Green, Red); |
CaptainR | 9:32eb75c01e9d | 107 | puts("\n\n\rDone!!!!"); |
CaptainR | 9:32eb75c01e9d | 108 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 109 | puts("\n\n\rNow extend to here!"); |
CaptainR | 9:32eb75c01e9d | 110 | wait_ms(SHORT_WAIT); |
CaptainR | 9:32eb75c01e9d | 111 | extendClipRegion(); |
CaptainR | 9:32eb75c01e9d | 112 | changeColor(Green, Red); |
CaptainR | 9:32eb75c01e9d | 113 | puts("\n\n\rHow does it look?"); |
CaptainR | 9:32eb75c01e9d | 114 | wait_ms(LONG_WAIT); |
CaptainR | 8:b634ac9c92f8 | 115 | //cls(); |
CaptainR | 9:32eb75c01e9d | 116 | |
CaptainR | 8:b634ac9c92f8 | 117 | |
CaptainR | 6:a1a85f2bc04b | 118 | |
CaptainR | 6:a1a85f2bc04b | 119 | |
CaptainR | 0:a5ef6bc3c2e8 | 120 | } |
CaptainR | 0:a5ef6bc3c2e8 | 121 | |
CaptainR | 0:a5ef6bc3c2e8 | 122 | //************************************************************************** |
CaptainR | 0:a5ef6bc3c2e8 | 123 | // Demo program that goes through main functions |
CaptainR | 0:a5ef6bc3c2e8 | 124 | //************************************************************************** |
CaptainR | 3:dcfbceb81fef | 125 | void PICASO_4DGL :: mainDemo() { |
CaptainR | 0:a5ef6bc3c2e8 | 126 | |
CaptainR | 0:a5ef6bc3c2e8 | 127 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 128 | puts("This is the main functions demo"); |
CaptainR | 0:a5ef6bc3c2e8 | 129 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 130 | cls(); |
CaptainR | 2:81eaaa491a02 | 131 | |
CaptainR | 0:a5ef6bc3c2e8 | 132 | puts("\nBaudrates:"); |
CaptainR | 0:a5ef6bc3c2e8 | 133 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 134 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 135 | baudrate(4800); |
CaptainR | 0:a5ef6bc3c2e8 | 136 | puts("\n4800"); |
CaptainR | 0:a5ef6bc3c2e8 | 137 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 138 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 139 | baudrate(9600); |
CaptainR | 0:a5ef6bc3c2e8 | 140 | puts("\n9600"); |
CaptainR | 0:a5ef6bc3c2e8 | 141 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 142 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 143 | baudrate(14400); |
CaptainR | 0:a5ef6bc3c2e8 | 144 | puts("\n14400"); |
CaptainR | 0:a5ef6bc3c2e8 | 145 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 146 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 147 | baudrate(19200); |
CaptainR | 0:a5ef6bc3c2e8 | 148 | puts("\n19200"); |
CaptainR | 0:a5ef6bc3c2e8 | 149 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 150 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 151 | baudrate(38400); |
CaptainR | 0:a5ef6bc3c2e8 | 152 | puts("\n38400"); |
CaptainR | 0:a5ef6bc3c2e8 | 153 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 154 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 155 | baudrate(56000); |
CaptainR | 0:a5ef6bc3c2e8 | 156 | puts("\n56000"); |
CaptainR | 0:a5ef6bc3c2e8 | 157 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 158 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 159 | baudrate(57600); |
CaptainR | 0:a5ef6bc3c2e8 | 160 | puts("\n57600"); |
CaptainR | 0:a5ef6bc3c2e8 | 161 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 162 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 163 | baudrate(115200); |
CaptainR | 0:a5ef6bc3c2e8 | 164 | puts("\n115200"); |
CaptainR | 0:a5ef6bc3c2e8 | 165 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 166 | cls(); |
CaptainR | 2:81eaaa491a02 | 167 | baudrate(128000); |
CaptainR | 2:81eaaa491a02 | 168 | puts("\n128000"); |
CaptainR | 2:81eaaa491a02 | 169 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 170 | cls(); |
CaptainR | 2:81eaaa491a02 | 171 | baudrate(256000); |
CaptainR | 2:81eaaa491a02 | 172 | puts("\n256000"); |
CaptainR | 2:81eaaa491a02 | 173 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 174 | cls(); |
CaptainR | 2:81eaaa491a02 | 175 | baudrate(300000); |
CaptainR | 2:81eaaa491a02 | 176 | puts("\n300000"); |
CaptainR | 2:81eaaa491a02 | 177 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 178 | cls(); |
CaptainR | 2:81eaaa491a02 | 179 | baudrate(375000); |
CaptainR | 2:81eaaa491a02 | 180 | puts("\n375000"); |
CaptainR | 2:81eaaa491a02 | 181 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 182 | cls(); |
CaptainR | 2:81eaaa491a02 | 183 | baudrate(500000); |
CaptainR | 2:81eaaa491a02 | 184 | puts("\n500000"); |
CaptainR | 2:81eaaa491a02 | 185 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 186 | cls(); |
CaptainR | 2:81eaaa491a02 | 187 | baudrate(600000); |
CaptainR | 2:81eaaa491a02 | 188 | puts("\n600000"); |
CaptainR | 2:81eaaa491a02 | 189 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 190 | cls(); |
CaptainR | 3:dcfbceb81fef | 191 | baudrate(115200); |
CaptainR | 3:dcfbceb81fef | 192 | puts("\nSet back to 115200"); |
CaptainR | 0:a5ef6bc3c2e8 | 193 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 194 | cls(); |
CaptainR | 2:81eaaa491a02 | 195 | |
CaptainR | 0:a5ef6bc3c2e8 | 196 | puts("\nOrientation:"); |
CaptainR | 0:a5ef6bc3c2e8 | 197 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 198 | cls(); |
CaptainR | 2:81eaaa491a02 | 199 | screenOrientation(landscape); |
CaptainR | 0:a5ef6bc3c2e8 | 200 | puts("landscape"); |
CaptainR | 0:a5ef6bc3c2e8 | 201 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 202 | cls(); |
CaptainR | 2:81eaaa491a02 | 203 | screenOrientation(landscapeRew); |
CaptainR | 0:a5ef6bc3c2e8 | 204 | puts("landscape rewersed"); |
CaptainR | 0:a5ef6bc3c2e8 | 205 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 206 | cls(); |
CaptainR | 2:81eaaa491a02 | 207 | screenOrientation(portrait); |
CaptainR | 0:a5ef6bc3c2e8 | 208 | puts("portrait"); |
CaptainR | 0:a5ef6bc3c2e8 | 209 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 210 | cls(); |
CaptainR | 2:81eaaa491a02 | 211 | screenOrientation(portraitRew); |
CaptainR | 0:a5ef6bc3c2e8 | 212 | puts("portrait rewersed"); |
CaptainR | 0:a5ef6bc3c2e8 | 213 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 214 | screenOrientation(landscape); // set back screen to landscape |
CaptainR | 0:a5ef6bc3c2e8 | 215 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 216 | |
CaptainR | 0:a5ef6bc3c2e8 | 217 | } |
CaptainR | 0:a5ef6bc3c2e8 | 218 | |
CaptainR | 0:a5ef6bc3c2e8 | 219 | //************************************************************************** |
CaptainR | 0:a5ef6bc3c2e8 | 220 | // Demo program that goes through text based functions |
CaptainR | 0:a5ef6bc3c2e8 | 221 | //************************************************************************** |
CaptainR | 3:dcfbceb81fef | 222 | void PICASO_4DGL :: textDemo() { |
CaptainR | 0:a5ef6bc3c2e8 | 223 | |
CaptainR | 0:a5ef6bc3c2e8 | 224 | cls(); |
CaptainR | 2:81eaaa491a02 | 225 | screenOrientation(landscape); // set screen to landscape |
CaptainR | 0:a5ef6bc3c2e8 | 226 | puts("This is the Text functions demo"); |
CaptainR | 0:a5ef6bc3c2e8 | 227 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 228 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 229 | |
CaptainR | 0:a5ef6bc3c2e8 | 230 | puts("\nText attributes:"); |
CaptainR | 0:a5ef6bc3c2e8 | 231 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 232 | //cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 233 | puts("\n\n"); |
CaptainR | 2:81eaaa491a02 | 234 | textAttributes(bold); |
CaptainR | 0:a5ef6bc3c2e8 | 235 | puts("\nBOLD"); |
CaptainR | 0:a5ef6bc3c2e8 | 236 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 237 | textAttributes(bold + italic); |
CaptainR | 0:a5ef6bc3c2e8 | 238 | puts("\nBOLD & ITALIC"); |
CaptainR | 0:a5ef6bc3c2e8 | 239 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 240 | textAttributes(bold + italic + inverse); |
CaptainR | 0:a5ef6bc3c2e8 | 241 | puts("\nBOLD & ITALIC & INVERSE"); |
CaptainR | 0:a5ef6bc3c2e8 | 242 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 243 | textAttributes(bold + italic + inverse + underline); |
CaptainR | 0:a5ef6bc3c2e8 | 244 | puts("\nBOLD & ITALIC & INVERSE & UNDERLINE"); |
CaptainR | 0:a5ef6bc3c2e8 | 245 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 246 | textAttributes(DISABLE); // set everything back to normal |
CaptainR | 0:a5ef6bc3c2e8 | 247 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 248 | |
CaptainR | 0:a5ef6bc3c2e8 | 249 | puts("\nText modes:"); |
CaptainR | 0:a5ef6bc3c2e8 | 250 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 251 | cls(); |
CaptainR | 2:81eaaa491a02 | 252 | textBold(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 253 | puts("\nBOLD:"); |
CaptainR | 0:a5ef6bc3c2e8 | 254 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 255 | textBold(DISABLE); |
CaptainR | 2:81eaaa491a02 | 256 | textInverse(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 257 | puts("\nINVERSE:"); |
CaptainR | 0:a5ef6bc3c2e8 | 258 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 259 | textInverse(DISABLE); |
CaptainR | 2:81eaaa491a02 | 260 | textItalic(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 261 | puts("\nITALIC:"); |
CaptainR | 0:a5ef6bc3c2e8 | 262 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 263 | textItalic(DISABLE); |
CaptainR | 2:81eaaa491a02 | 264 | textUnderline(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 265 | puts("\nUNDERLINE:"); |
CaptainR | 0:a5ef6bc3c2e8 | 266 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 267 | textUnderline(DISABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 268 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 269 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 270 | |
CaptainR | 0:a5ef6bc3c2e8 | 271 | puts("\nText gaps:"); |
CaptainR | 0:a5ef6bc3c2e8 | 272 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 273 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 274 | if (textXGap(0) == 1) puts("\nX gap: 0"); |
CaptainR | 0:a5ef6bc3c2e8 | 275 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 276 | if (textXGap(1) == 1) puts("\nX gap: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 277 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 278 | if (textXGap(2) == 1) puts("\nX gap: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 279 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 280 | if (textXGap(3) == 1) puts("\nX gap: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 281 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 282 | if (textXGap(4) == 1) puts("\nX gap: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 283 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 284 | if (textXGap(5) == 1) puts("\nX gap: 5"); |
CaptainR | 0:a5ef6bc3c2e8 | 285 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 286 | if (textXGap(6) == 1) puts("\nX gap: 6"); |
CaptainR | 0:a5ef6bc3c2e8 | 287 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 288 | puts("\n"); |
CaptainR | 0:a5ef6bc3c2e8 | 289 | textXGap(0); |
CaptainR | 0:a5ef6bc3c2e8 | 290 | if (textYGap(0) == 1) puts("\nY gap: 0"); |
CaptainR | 0:a5ef6bc3c2e8 | 291 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 292 | if (textYGap(1) == 1) puts("\nY gap: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 293 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 294 | if (textYGap(2) == 1) puts("\nY gap: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 295 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 296 | if (textYGap(3) == 1) puts("\nY gap: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 297 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 298 | if (textYGap(4) == 1) puts("\nY gap: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 299 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 300 | if (textYGap(5) == 1) puts("\nY gap: 5"); |
CaptainR | 0:a5ef6bc3c2e8 | 301 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 302 | if (textYGap(6) == 1) puts("\nY gap: 6"); |
CaptainR | 0:a5ef6bc3c2e8 | 303 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 304 | textYGap(0); |
CaptainR | 0:a5ef6bc3c2e8 | 305 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 306 | |
CaptainR | 0:a5ef6bc3c2e8 | 307 | puts("Text width:"); |
CaptainR | 0:a5ef6bc3c2e8 | 308 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 309 | if (textWidth(1) == 1) puts("\nWidth: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 310 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 311 | if (textWidth(2) == 1) puts("\nWidth: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 312 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 313 | if (textWidth(3) == 1) puts("\nWidth: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 314 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 315 | if (textWidth(4) == 1) puts("\nWidth: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 316 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 317 | textWidth(1); |
CaptainR | 0:a5ef6bc3c2e8 | 318 | puts("\nText height:"); |
CaptainR | 0:a5ef6bc3c2e8 | 319 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 320 | //cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 321 | if (textHeight(1) == 1) puts("\nHeight: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 322 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 323 | if (textHeight(2) == 1) puts("\nHeight: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 324 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 325 | if (textHeight(3) == 1) puts("\nHeight: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 326 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 327 | if (textHeight(4) == 1) puts("\nHeight: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 328 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 329 | textHeight(1); |
CaptainR | 0:a5ef6bc3c2e8 | 330 | cls(); |
CaptainR | 2:81eaaa491a02 | 331 | |
CaptainR | 0:a5ef6bc3c2e8 | 332 | puts("Fonts:"); |
CaptainR | 0:a5ef6bc3c2e8 | 333 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 334 | cls(); |
CaptainR | 2:81eaaa491a02 | 335 | setFont(font1); |
CaptainR | 0:a5ef6bc3c2e8 | 336 | puts("\nThis is Font 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 337 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 338 | setFont(font2); |
CaptainR | 0:a5ef6bc3c2e8 | 339 | puts("\nThis is Font 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 340 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 341 | setFont(font3); |
CaptainR | 0:a5ef6bc3c2e8 | 342 | puts("\nThis is Font 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 343 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 344 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 345 | |
CaptainR | 2:81eaaa491a02 | 346 | |
CaptainR | 2:81eaaa491a02 | 347 | screenOrientation(portrait); |
CaptainR | 0:a5ef6bc3c2e8 | 348 | puts("\nText Background colors:"); |
CaptainR | 0:a5ef6bc3c2e8 | 349 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 350 | cls(); |
CaptainR | 2:81eaaa491a02 | 351 | textBgColor(Black); |
CaptainR | 3:dcfbceb81fef | 352 | puts("\nBG Color = BLACK"); |
CaptainR | 0:a5ef6bc3c2e8 | 353 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 354 | textBgColor(Navy); |
CaptainR | 3:dcfbceb81fef | 355 | puts("\nBG Color = NAVY"); |
CaptainR | 0:a5ef6bc3c2e8 | 356 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 357 | textFgColor(Black); |
CaptainR | 2:81eaaa491a02 | 358 | textBgColor(DGreen); |
CaptainR | 3:dcfbceb81fef | 359 | puts("\nBG Color = DARK GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 360 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 361 | textBgColor(DCyan); |
CaptainR | 3:dcfbceb81fef | 362 | puts("\nBG Color = DARK CYAN"); |
CaptainR | 0:a5ef6bc3c2e8 | 363 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 364 | textBgColor(Purple); |
CaptainR | 3:dcfbceb81fef | 365 | puts("\nBG Color = PURPLE"); |
CaptainR | 0:a5ef6bc3c2e8 | 366 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 367 | textBgColor(Olive); |
CaptainR | 3:dcfbceb81fef | 368 | puts("\nBG Color = OLIVE"); |
CaptainR | 0:a5ef6bc3c2e8 | 369 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 370 | textBgColor(Grey); |
CaptainR | 3:dcfbceb81fef | 371 | puts("\nBG Color = GREY"); |
CaptainR | 0:a5ef6bc3c2e8 | 372 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 373 | textBgColor(Blue); |
CaptainR | 3:dcfbceb81fef | 374 | puts("\nBG Color = BLUE"); |
CaptainR | 0:a5ef6bc3c2e8 | 375 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 376 | textBgColor(Green); |
CaptainR | 3:dcfbceb81fef | 377 | puts("\nBG Color = GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 378 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 379 | textBgColor(Red); |
CaptainR | 3:dcfbceb81fef | 380 | puts("\nBG Color = RED"); |
CaptainR | 0:a5ef6bc3c2e8 | 381 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 382 | textBgColor(Yellow); |
CaptainR | 3:dcfbceb81fef | 383 | puts("\nBG Color = YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 384 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 385 | textBgColor(GYellow); |
CaptainR | 3:dcfbceb81fef | 386 | puts("\nBG Color = GREEN YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 387 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 388 | textBgColor(White); |
CaptainR | 3:dcfbceb81fef | 389 | puts("\nBG Color = WHITE"); |
CaptainR | 0:a5ef6bc3c2e8 | 390 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 391 | textBgColor(Orange); |
CaptainR | 3:dcfbceb81fef | 392 | puts("\nBG Color = ORANGE"); |
CaptainR | 0:a5ef6bc3c2e8 | 393 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 394 | textBgColor(Pink); |
CaptainR | 3:dcfbceb81fef | 395 | puts("\nBG Color = PINK"); |
CaptainR | 0:a5ef6bc3c2e8 | 396 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 397 | textBgColor(Violet); |
CaptainR | 3:dcfbceb81fef | 398 | puts("\nBG Color = VIOLET"); |
CaptainR | 0:a5ef6bc3c2e8 | 399 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 400 | textBgColor(Aqua); |
CaptainR | 3:dcfbceb81fef | 401 | puts("\nBG Color = AQUA"); |
CaptainR | 0:a5ef6bc3c2e8 | 402 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 403 | textBgColor(Cream); |
CaptainR | 3:dcfbceb81fef | 404 | puts("\nBG Color = CREAM"); |
CaptainR | 0:a5ef6bc3c2e8 | 405 | wait_ms(LONG_WAIT); |
CaptainR | 3:dcfbceb81fef | 406 | textBgColor(Black); // set Color back |
CaptainR | 3:dcfbceb81fef | 407 | textFgColor(Green); // set Color back |
CaptainR | 0:a5ef6bc3c2e8 | 408 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 409 | |
CaptainR | 0:a5ef6bc3c2e8 | 410 | puts("Lets try moving cursor..."); |
CaptainR | 0:a5ef6bc3c2e8 | 411 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 412 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 413 | if (moveCursor(5, 5) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 414 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 415 | if (moveCursor(10, 10) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 416 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 417 | screenOrientation(4); |
CaptainR | 0:a5ef6bc3c2e8 | 418 | if (moveCursor(50, 50) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 419 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 420 | if (moveCursor(19, 29) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 421 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 422 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 423 | |
CaptainR | 0:a5ef6bc3c2e8 | 424 | |
CaptainR | 2:81eaaa491a02 | 425 | screenOrientation(portrait); |
CaptainR | 3:dcfbceb81fef | 426 | puts("\nText Foreground Colors:"); |
CaptainR | 0:a5ef6bc3c2e8 | 427 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 428 | cls(); |
CaptainR | 2:81eaaa491a02 | 429 | textBgColor(White); |
CaptainR | 2:81eaaa491a02 | 430 | textFgColor(Black); |
CaptainR | 3:dcfbceb81fef | 431 | puts("\nFG Color = BLACK"); |
CaptainR | 2:81eaaa491a02 | 432 | textBgColor(Black); |
CaptainR | 0:a5ef6bc3c2e8 | 433 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 434 | textFgColor(Navy); |
CaptainR | 3:dcfbceb81fef | 435 | puts("\nFG Color = NAVY"); |
CaptainR | 0:a5ef6bc3c2e8 | 436 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 437 | textFgColor(DGreen); |
CaptainR | 3:dcfbceb81fef | 438 | puts("\nFG Color = DARK GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 439 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 440 | textFgColor(DCyan); |
CaptainR | 3:dcfbceb81fef | 441 | puts("\nFG Color = DARK CYAN"); |
CaptainR | 0:a5ef6bc3c2e8 | 442 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 443 | textFgColor(Purple); |
CaptainR | 3:dcfbceb81fef | 444 | puts("\nFG Color = PURPLE"); |
CaptainR | 0:a5ef6bc3c2e8 | 445 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 446 | textFgColor(Olive); |
CaptainR | 3:dcfbceb81fef | 447 | puts("\nFG Color = OLIVE"); |
CaptainR | 0:a5ef6bc3c2e8 | 448 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 449 | textFgColor(Grey); |
CaptainR | 3:dcfbceb81fef | 450 | puts("\nFG Color = GREY"); |
CaptainR | 0:a5ef6bc3c2e8 | 451 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 452 | textFgColor(Blue); |
CaptainR | 3:dcfbceb81fef | 453 | puts("\nFG Color = BLUE"); |
CaptainR | 0:a5ef6bc3c2e8 | 454 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 455 | textFgColor(Green); |
CaptainR | 3:dcfbceb81fef | 456 | puts("\nFG Color = GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 457 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 458 | textFgColor(Red); |
CaptainR | 3:dcfbceb81fef | 459 | puts("\nFG Color = RED"); |
CaptainR | 0:a5ef6bc3c2e8 | 460 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 461 | textFgColor(Yellow); |
CaptainR | 3:dcfbceb81fef | 462 | puts("\nFG Color = YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 463 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 464 | textFgColor(GYellow); |
CaptainR | 3:dcfbceb81fef | 465 | puts("\nFG Color = GREEN YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 466 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 467 | textFgColor(White); |
CaptainR | 3:dcfbceb81fef | 468 | puts("\nFG Color = WHITE"); |
CaptainR | 0:a5ef6bc3c2e8 | 469 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 470 | textFgColor(Orange); |
CaptainR | 3:dcfbceb81fef | 471 | puts("\nFG Color = ORANGE"); |
CaptainR | 0:a5ef6bc3c2e8 | 472 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 473 | textFgColor(Pink); |
CaptainR | 3:dcfbceb81fef | 474 | puts("\nFG Color = PINK"); |
CaptainR | 0:a5ef6bc3c2e8 | 475 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 476 | textFgColor(Violet); |
CaptainR | 3:dcfbceb81fef | 477 | puts("\nFG Color = VIOLET"); |
CaptainR | 0:a5ef6bc3c2e8 | 478 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 479 | textFgColor(Aqua); |
CaptainR | 3:dcfbceb81fef | 480 | puts("\nFG Color = AQUA"); |
CaptainR | 0:a5ef6bc3c2e8 | 481 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 482 | textFgColor(Cream); |
CaptainR | 3:dcfbceb81fef | 483 | puts("\nFG Color = CREAM"); |
CaptainR | 2:81eaaa491a02 | 484 | wait_ms(LONG_WAIT); |
CaptainR | 3:dcfbceb81fef | 485 | textFgColor(Green); // set Color back |
CaptainR | 2:81eaaa491a02 | 486 | |
CaptainR | 2:81eaaa491a02 | 487 | |
CaptainR | 0:a5ef6bc3c2e8 | 488 | } |