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