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