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