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