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@26:c6a803706a42, 2016-09-28 (annotated)
- Committer:
- CaptainR
- Date:
- Wed Sep 28 12:41:32 2016 +0000
- Revision:
- 26:c6a803706a42
- Parent:
- 25:015631f9e875
- Child:
- 27:dbf79d116497
File open File close File read File seek File index File tell File write File size ; Display image and screen capture not working yet???
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 | 12:29f5ad896382 | 6 | #define LONG_WAIT 1000 |
CaptainR | 0:a5ef6bc3c2e8 | 7 | |
CaptainR | 22:cea582ea74c1 | 8 | // local declarations |
CaptainR | 26:c6a803706a42 | 9 | void clearBuf(char*, int); |
CaptainR | 20:88e137b9ea46 | 10 | |
CaptainR | 20:88e137b9ea46 | 11 | //************************************************************************** |
CaptainR | 20:88e137b9ea46 | 12 | // Demo program that goes through file system based functions |
CaptainR | 20:88e137b9ea46 | 13 | //************************************************************************** |
CaptainR | 20:88e137b9ea46 | 14 | void PICASO_4DGL :: fileSystemDemo() { |
CaptainR | 20:88e137b9ea46 | 15 | |
CaptainR | 26:c6a803706a42 | 16 | short h1; |
CaptainR | 23:dd2c28fa4dfd | 17 | int i; |
CaptainR | 20:88e137b9ea46 | 18 | cls(); |
CaptainR | 20:88e137b9ea46 | 19 | screenMode(landscape); // set orientation to landscape |
CaptainR | 20:88e137b9ea46 | 20 | puts("\n\rThis is the File system functions demo"); |
CaptainR | 20:88e137b9ea46 | 21 | wait_ms(LONG_WAIT); |
CaptainR | 20:88e137b9ea46 | 22 | cls(); |
CaptainR | 20:88e137b9ea46 | 23 | |
CaptainR | 22:cea582ea74c1 | 24 | if (file_Mount()) puts("\rFAT16 Mount: OK"); |
CaptainR | 22:cea582ea74c1 | 25 | else puts("\rFAT16 Mount: FAIL"); |
CaptainR | 22:cea582ea74c1 | 26 | char buf[100]; |
CaptainR | 26:c6a803706a42 | 27 | sprintf(buf, "\n\rFAT16 Error = %i\n", file_Error()); |
CaptainR | 21:ea68a8a3cea4 | 28 | puts(buf); |
CaptainR | 26:c6a803706a42 | 29 | /* |
CaptainR | 22:cea582ea74c1 | 30 | sprintf(buf, "\n\rFile count on disc = %i\n\r", file_Count("*.*")); |
CaptainR | 22:cea582ea74c1 | 31 | puts(buf); |
CaptainR | 25:015631f9e875 | 32 | sprintf(buf, "\n\rFound %i files maching 1*.*", file_Dir("1*.*")); |
CaptainR | 22:cea582ea74c1 | 33 | puts(buf); |
CaptainR | 22:cea582ea74c1 | 34 | file_FindFirst("*.TXT"); |
CaptainR | 23:dd2c28fa4dfd | 35 | char filename[FILENAME_LENGTH]; |
CaptainR | 23:dd2c28fa4dfd | 36 | for (i = 0; i < FILENAME_LENGTH; i++) |
CaptainR | 23:dd2c28fa4dfd | 37 | filename[i] = 0; |
CaptainR | 23:dd2c28fa4dfd | 38 | short len = file_FindFirstRet("*.TXT", filename); |
CaptainR | 24:19c77967674e | 39 | sprintf(buf, "\n\rFirst filename = %s\n Length = %i", filename, len); |
CaptainR | 24:19c77967674e | 40 | puts(buf); |
CaptainR | 24:19c77967674e | 41 | for (i = 0; i < FILENAME_LENGTH; i++) |
CaptainR | 24:19c77967674e | 42 | filename[i] = 0; |
CaptainR | 24:19c77967674e | 43 | file_FindNext(); |
CaptainR | 24:19c77967674e | 44 | len = file_FindNextRet(filename); |
CaptainR | 24:19c77967674e | 45 | sprintf(buf, "\n\rNext filename = %s\n Length = %i", filename, len); |
CaptainR | 23:dd2c28fa4dfd | 46 | puts(buf); |
CaptainR | 25:015631f9e875 | 47 | file_FindNext(); |
CaptainR | 25:015631f9e875 | 48 | file_FindNext(); |
CaptainR | 25:015631f9e875 | 49 | file_FindNext(); |
CaptainR | 25:015631f9e875 | 50 | if (file_Exists("3.TXT")) puts("\n\r3.TXT : EXISTS"); |
CaptainR | 25:015631f9e875 | 51 | else puts("\n\r3.TXT : DOES NOT EXIST"); |
CaptainR | 25:015631f9e875 | 52 | if (file_Exists("4.TXT")) puts("\n\r4.TXT : EXISTS"); |
CaptainR | 25:015631f9e875 | 53 | else puts("\n\r4.TXT : DOES NOT EXIST"); |
CaptainR | 26:c6a803706a42 | 54 | wait_ms(LONG_WAIT); |
CaptainR | 26:c6a803706a42 | 55 | cls(); |
CaptainR | 26:c6a803706a42 | 56 | */ |
CaptainR | 26:c6a803706a42 | 57 | |
CaptainR | 26:c6a803706a42 | 58 | h1 = file_Open("file.txt", OPEN_READ); |
CaptainR | 26:c6a803706a42 | 59 | short err = file_Error(); |
CaptainR | 26:c6a803706a42 | 60 | if (err == 0) sprintf(buf, "\r\file.txt handle = %i", h1); |
CaptainR | 26:c6a803706a42 | 61 | else sprintf(buf, "\rFile Open error = %i", err); |
CaptainR | 26:c6a803706a42 | 62 | puts(buf); |
CaptainR | 26:c6a803706a42 | 63 | short count = file_Read(31, h1); |
CaptainR | 26:c6a803706a42 | 64 | if (count == 31) sprintf(buf, "\r\nRead %i bytes from %i", count, h1); |
CaptainR | 26:c6a803706a42 | 65 | else sprintf(buf, "\r\nError = %i\n\rMax data count = %i", file_Error(), count); |
CaptainR | 26:c6a803706a42 | 66 | puts(buf); |
CaptainR | 26:c6a803706a42 | 67 | sprintf(buf, "\r\nData: %s", fileReadBuf); |
CaptainR | 26:c6a803706a42 | 68 | puts(buf); |
CaptainR | 26:c6a803706a42 | 69 | |
CaptainR | 26:c6a803706a42 | 70 | clearBuf(fileReadBuf, BUFFER_SIZE); |
CaptainR | 26:c6a803706a42 | 71 | short hi = 0, lo = 5; |
CaptainR | 26:c6a803706a42 | 72 | sprintf(buf, "\r\nSetting pointer to %i = %s", lo, file_Seek(h1, hi, lo) ? "true" : "false"); |
CaptainR | 26:c6a803706a42 | 73 | puts(buf); |
CaptainR | 26:c6a803706a42 | 74 | file_Read(1, h1); |
CaptainR | 26:c6a803706a42 | 75 | sprintf(buf, "\r\nRead char = %c", fileReadBuf[0]); |
CaptainR | 26:c6a803706a42 | 76 | puts(buf); |
CaptainR | 26:c6a803706a42 | 77 | |
CaptainR | 26:c6a803706a42 | 78 | clearBuf(fileReadBuf, BUFFER_SIZE); |
CaptainR | 26:c6a803706a42 | 79 | short recNum = 2; |
CaptainR | 26:c6a803706a42 | 80 | sprintf(buf, "\r\nIndex pointer to %i = %s", lo, file_Index(h1, hi, lo, recNum) ? "true" : "false"); |
CaptainR | 26:c6a803706a42 | 81 | puts(buf); |
CaptainR | 26:c6a803706a42 | 82 | file_Read(1, h1); |
CaptainR | 26:c6a803706a42 | 83 | sprintf(buf, "\r\nRead char = %c", fileReadBuf[0]); |
CaptainR | 26:c6a803706a42 | 84 | puts(buf); |
CaptainR | 26:c6a803706a42 | 85 | |
CaptainR | 26:c6a803706a42 | 86 | int pointer = file_Tell(h1); |
CaptainR | 26:c6a803706a42 | 87 | if (pointer >= 0) sprintf(buf, "\r\nPointer = %i", pointer); |
CaptainR | 26:c6a803706a42 | 88 | else sprintf(buf, "\r\nError = %i", file_Error()); |
CaptainR | 26:c6a803706a42 | 89 | puts(buf); |
CaptainR | 26:c6a803706a42 | 90 | |
CaptainR | 26:c6a803706a42 | 91 | sprintf(buf, "\r\nFile %i Close = %s", h1, file_Close(h1) ? "true" : "false"); |
CaptainR | 26:c6a803706a42 | 92 | puts(buf); |
CaptainR | 26:c6a803706a42 | 93 | |
CaptainR | 26:c6a803706a42 | 94 | h1 = file_Open("newfile.txt", OPEN_READ); |
CaptainR | 26:c6a803706a42 | 95 | err = file_Error(); |
CaptainR | 26:c6a803706a42 | 96 | if (err == 0) sprintf(buf, "\r\nnewfile.txt handle = %i", h1); |
CaptainR | 26:c6a803706a42 | 97 | else sprintf(buf, "\rFile Open error = %i", err); |
CaptainR | 26:c6a803706a42 | 98 | puts(buf); |
CaptainR | 26:c6a803706a42 | 99 | |
CaptainR | 26:c6a803706a42 | 100 | clearBuf(fileReadBuf, BUFFER_SIZE); |
CaptainR | 26:c6a803706a42 | 101 | count = file_Read(18, h1); |
CaptainR | 26:c6a803706a42 | 102 | if (count == 18) sprintf(buf, "\r\nRead %i bytes from %i", count, h1); |
CaptainR | 26:c6a803706a42 | 103 | else sprintf(buf, "\r\nError = %i\n\rMax data count = %i", file_Error(), count); |
CaptainR | 26:c6a803706a42 | 104 | puts(buf); |
CaptainR | 26:c6a803706a42 | 105 | sprintf(buf, "\r\nData: %s", fileReadBuf); |
CaptainR | 26:c6a803706a42 | 106 | puts(buf); |
CaptainR | 26:c6a803706a42 | 107 | |
CaptainR | 26:c6a803706a42 | 108 | sprintf(buf, "\r\nFile %i size = %i", h1, file_Size(h1)); |
CaptainR | 26:c6a803706a42 | 109 | puts(buf); |
CaptainR | 26:c6a803706a42 | 110 | |
CaptainR | 26:c6a803706a42 | 111 | sprintf(buf, "\r\nFile %i Close = %s", h1, file_Close(h1) ? "true" : "false"); |
CaptainR | 26:c6a803706a42 | 112 | puts(buf); |
CaptainR | 26:c6a803706a42 | 113 | |
CaptainR | 26:c6a803706a42 | 114 | short h2 = file_Open("scr.png", OPEN_APPEND); |
CaptainR | 26:c6a803706a42 | 115 | file_ScreenCapture(10, 10, 200, 100, h2); |
CaptainR | 26:c6a803706a42 | 116 | file_Close(h2); |
CaptainR | 26:c6a803706a42 | 117 | |
CaptainR | 26:c6a803706a42 | 118 | wait_ms(LONG_WAIT); |
CaptainR | 26:c6a803706a42 | 119 | cls(); |
CaptainR | 26:c6a803706a42 | 120 | |
CaptainR | 26:c6a803706a42 | 121 | h2 = file_Open("pic.bmp", OPEN_READ); |
CaptainR | 26:c6a803706a42 | 122 | file_Image(5, 5, h2); |
CaptainR | 26:c6a803706a42 | 123 | |
CaptainR | 26:c6a803706a42 | 124 | /* |
CaptainR | 26:c6a803706a42 | 125 | h1 = file_Open("newfile.txt", OPEN_APPEND); // try appending to file |
CaptainR | 26:c6a803706a42 | 126 | err = file_Error(); |
CaptainR | 26:c6a803706a42 | 127 | if (err == 0) sprintf(buf, "\r\nnewfile.txt handle = %i", h1); |
CaptainR | 26:c6a803706a42 | 128 | else sprintf(buf, "\rFile Open error = %i", err); |
CaptainR | 26:c6a803706a42 | 129 | puts(buf); |
CaptainR | 26:c6a803706a42 | 130 | |
CaptainR | 26:c6a803706a42 | 131 | count = file_Write(13, " My Precious!", h1); // add data |
CaptainR | 26:c6a803706a42 | 132 | file_Close(h1); // close file |
CaptainR | 26:c6a803706a42 | 133 | h1 = file_Open("newfile.txt", OPEN_READ); // open in read mode again |
CaptainR | 26:c6a803706a42 | 134 | err = file_Error(); |
CaptainR | 26:c6a803706a42 | 135 | if (err != 0) { |
CaptainR | 26:c6a803706a42 | 136 | sprintf(buf, "\rFile Open error = %i", err); |
CaptainR | 26:c6a803706a42 | 137 | puts(buf); |
CaptainR | 26:c6a803706a42 | 138 | } |
CaptainR | 26:c6a803706a42 | 139 | |
CaptainR | 26:c6a803706a42 | 140 | clearBuf(fileReadBuf, BUFFER_SIZE); // clear buffer |
CaptainR | 26:c6a803706a42 | 141 | count = file_Read(18, h1); // read bytes |
CaptainR | 26:c6a803706a42 | 142 | if (count != 18) { |
CaptainR | 26:c6a803706a42 | 143 | sprintf(buf, "\r\nError = %i\n\rMax data count = %i", file_Error(), count); |
CaptainR | 26:c6a803706a42 | 144 | puts(buf); |
CaptainR | 26:c6a803706a42 | 145 | } |
CaptainR | 26:c6a803706a42 | 146 | sprintf(buf, "\r\nData: %s", fileReadBuf); |
CaptainR | 26:c6a803706a42 | 147 | puts(buf); |
CaptainR | 26:c6a803706a42 | 148 | */ |
CaptainR | 26:c6a803706a42 | 149 | |
CaptainR | 25:015631f9e875 | 150 | |
CaptainR | 20:88e137b9ea46 | 151 | } |
CaptainR | 0:a5ef6bc3c2e8 | 152 | //************************************************************************** |
CaptainR | 12:29f5ad896382 | 153 | // Demo program that goes through media based functions |
CaptainR | 12:29f5ad896382 | 154 | //************************************************************************** |
CaptainR | 12:29f5ad896382 | 155 | void PICASO_4DGL :: mediaDemo() { |
CaptainR | 12:29f5ad896382 | 156 | |
CaptainR | 12:29f5ad896382 | 157 | cls(); |
CaptainR | 12:29f5ad896382 | 158 | screenMode(landscape); // set orientation to landscape |
CaptainR | 12:29f5ad896382 | 159 | puts("\n\rThis is the Media functions demo"); |
CaptainR | 12:29f5ad896382 | 160 | wait_ms(LONG_WAIT); |
CaptainR | 12:29f5ad896382 | 161 | cls(); |
CaptainR | 12:29f5ad896382 | 162 | |
CaptainR | 12:29f5ad896382 | 163 | wait_ms(SHORT_WAIT); |
CaptainR | 12:29f5ad896382 | 164 | if (media_Init()) puts("\n\r uSD card Initialization: OK"); |
CaptainR | 12:29f5ad896382 | 165 | else puts("\n\r uSD card Initialization: FAIL"); |
CaptainR | 14:561cb06a2739 | 166 | if (media_SetAdd(513)) puts("\n\r Byte address set: OK"); |
CaptainR | 14:561cb06a2739 | 167 | else puts("\n\r Byte address set: FAIL"); |
CaptainR | 12:29f5ad896382 | 168 | if (media_SetSector(1)) puts("\n\r Sector address set: OK"); |
CaptainR | 12:29f5ad896382 | 169 | else puts("\n\r Sector address set: FAIL"); |
CaptainR | 16:cb072eea16e9 | 170 | /* |
CaptainR | 16:cb072eea16e9 | 171 | puts("\n\r Now write some data in multiple sectors"); |
CaptainR | 15:86bdf382e6f7 | 172 | |
CaptainR | 15:86bdf382e6f7 | 173 | char array[1030]; |
CaptainR | 15:86bdf382e6f7 | 174 | for (int i = 0; i < 1030; i++) |
CaptainR | 15:86bdf382e6f7 | 175 | array[i] = 1; |
CaptainR | 15:86bdf382e6f7 | 176 | |
CaptainR | 12:29f5ad896382 | 177 | wait_ms(LONG_WAIT); |
CaptainR | 15:86bdf382e6f7 | 178 | if (media_WrSector(array)) puts("\n\r Write Data: OK"); |
CaptainR | 15:86bdf382e6f7 | 179 | else puts("\n\r Write Data: FAIL"); |
CaptainR | 14:561cb06a2739 | 180 | wait_ms(LONG_WAIT); |
CaptainR | 16:cb072eea16e9 | 181 | puts("\n\r Now read the same data"); |
CaptainR | 14:561cb06a2739 | 182 | if (media_SetSector(1)) puts("\n\r Sector address set: OK"); |
CaptainR | 15:86bdf382e6f7 | 183 | if (media_RdSector()) puts("\n\r Read Sector 1: OK"); |
CaptainR | 15:86bdf382e6f7 | 184 | else puts("\n\r Read Sector 1: FAIL"); |
CaptainR | 15:86bdf382e6f7 | 185 | if (media_RdSector()) puts("\n\r Read Sector 2: OK"); |
CaptainR | 15:86bdf382e6f7 | 186 | else puts("\n\r Read Sector 2: FAIL"); |
CaptainR | 15:86bdf382e6f7 | 187 | if (media_RdSector()) puts("\n\r Read Sector 3: OK"); |
CaptainR | 15:86bdf382e6f7 | 188 | else puts("\n\r Read Sector 3: FAIL"); |
CaptainR | 15:86bdf382e6f7 | 189 | if (media_RdSector()) puts("\n\r Read Sector 4: OK"); |
CaptainR | 15:86bdf382e6f7 | 190 | else puts("\n\r Read Sector 4: FAIL"); |
CaptainR | 15:86bdf382e6f7 | 191 | if (media_RdSector()) puts("\n\r Read Sector 5: OK"); |
CaptainR | 15:86bdf382e6f7 | 192 | else puts("\n\r Read Sector 5: FAIL"); |
CaptainR | 16:cb072eea16e9 | 193 | */ |
CaptainR | 16:cb072eea16e9 | 194 | media_SetSector(1); |
CaptainR | 16:cb072eea16e9 | 195 | puts("\n\r Now write some data in one sector"); |
CaptainR | 16:cb072eea16e9 | 196 | wait_ms(LONG_WAIT); |
CaptainR | 16:cb072eea16e9 | 197 | if (media_WrSector("Such data Much WOW")) puts("\n\r Write Data: OK"); |
CaptainR | 16:cb072eea16e9 | 198 | else puts("\n\r Write Data: FAIL"); |
CaptainR | 16:cb072eea16e9 | 199 | wait_ms(LONG_WAIT); |
CaptainR | 16:cb072eea16e9 | 200 | puts("\n\r Now read the same data"); |
CaptainR | 16:cb072eea16e9 | 201 | media_SetSector(1); |
CaptainR | 16:cb072eea16e9 | 202 | if (media_RdSector()) { |
CaptainR | 16:cb072eea16e9 | 203 | puts("\n\r Read Sector : OK"); |
CaptainR | 16:cb072eea16e9 | 204 | pc.printf("\n\r Data: "); |
CaptainR | 16:cb072eea16e9 | 205 | for(int i = 0; i < BUFFER_SIZE; i++) pc.printf("%c", buffer[i]); |
CaptainR | 16:cb072eea16e9 | 206 | pc.printf("\n\r"); |
CaptainR | 16:cb072eea16e9 | 207 | } |
CaptainR | 16:cb072eea16e9 | 208 | else puts("\n\r Read Sector : FAIL"); |
CaptainR | 12:29f5ad896382 | 209 | |
CaptainR | 16:cb072eea16e9 | 210 | puts("\n\r Now read one byte"); |
CaptainR | 18:829f3e2c064c | 211 | media_SetAdd(510); |
CaptainR | 16:cb072eea16e9 | 212 | if (media_ReadByte()) puts("\n\r Read Byte : OK"); |
CaptainR | 16:cb072eea16e9 | 213 | else puts("\n\r Read Byte : FAIL"); |
CaptainR | 18:829f3e2c064c | 214 | |
CaptainR | 18:829f3e2c064c | 215 | puts("\n\r Now read one word"); |
CaptainR | 18:829f3e2c064c | 216 | if (media_ReadByte()) puts("\n\r Read word : OK"); |
CaptainR | 18:829f3e2c064c | 217 | else puts("\n\r Read word : FAIL"); |
CaptainR | 19:a259bc128867 | 218 | |
CaptainR | 19:a259bc128867 | 219 | puts("\n\r Now write one byte"); |
CaptainR | 19:a259bc128867 | 220 | media_SetSector(1); |
CaptainR | 19:a259bc128867 | 221 | if (media_WriteByte('a')) puts("\n\r Write Byte : OK"); |
CaptainR | 19:a259bc128867 | 222 | else puts("\n\r Write Byte : FAIL"); |
CaptainR | 20:88e137b9ea46 | 223 | if (media_Flush()) puts("\n\r Flush : OK"); |
CaptainR | 20:88e137b9ea46 | 224 | else puts("\n\r Flush : FAIL"); |
CaptainR | 20:88e137b9ea46 | 225 | |
CaptainR | 20:88e137b9ea46 | 226 | puts("\n\r Now write one word (2 bytes)"); |
CaptainR | 20:88e137b9ea46 | 227 | //media_SetSector(1); |
CaptainR | 20:88e137b9ea46 | 228 | if (media_WriteWord(19)) puts("\n\r Write Word : OK"); |
CaptainR | 20:88e137b9ea46 | 229 | else puts("\n\r Write Word : FAIL"); |
CaptainR | 20:88e137b9ea46 | 230 | if (media_Flush()) puts("\n\r Flush : OK"); |
CaptainR | 20:88e137b9ea46 | 231 | else puts("\n\r Flush : FAIL"); |
CaptainR | 21:ea68a8a3cea4 | 232 | wait_ms(LONG_WAIT); |
CaptainR | 19:a259bc128867 | 233 | |
CaptainR | 12:29f5ad896382 | 234 | } |
CaptainR | 12:29f5ad896382 | 235 | //************************************************************************** |
CaptainR | 0:a5ef6bc3c2e8 | 236 | // Demo program that goes through graphics based functions |
CaptainR | 0:a5ef6bc3c2e8 | 237 | //************************************************************************** |
CaptainR | 3:dcfbceb81fef | 238 | void PICASO_4DGL :: graphicsDemo() { |
CaptainR | 0:a5ef6bc3c2e8 | 239 | |
CaptainR | 12:29f5ad896382 | 240 | |
CaptainR | 12:29f5ad896382 | 241 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 242 | screenMode(landscape); // set orientation to landscape |
CaptainR | 0:a5ef6bc3c2e8 | 243 | puts("This is the Graphics functions demo"); |
CaptainR | 0:a5ef6bc3c2e8 | 244 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 245 | cls(); |
CaptainR | 12:29f5ad896382 | 246 | |
CaptainR | 11:3ebd2263f3e9 | 247 | puts("\nLets change background color:"); |
CaptainR | 11:3ebd2263f3e9 | 248 | bgColor(Purple); |
CaptainR | 11:3ebd2263f3e9 | 249 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 250 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 251 | bgColor(White); |
CaptainR | 11:3ebd2263f3e9 | 252 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 253 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 254 | bgColor(Blue); |
CaptainR | 11:3ebd2263f3e9 | 255 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 256 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 257 | bgColor(Red); |
CaptainR | 11:3ebd2263f3e9 | 258 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 259 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 260 | bgColor(Aqua); |
CaptainR | 11:3ebd2263f3e9 | 261 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 262 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 263 | bgColor(Black); |
CaptainR | 11:3ebd2263f3e9 | 264 | cls(); |
CaptainR | 12:29f5ad896382 | 265 | wait_ms(LONG_WAIT); |
CaptainR | 12:29f5ad896382 | 266 | |
CaptainR | 11:3ebd2263f3e9 | 267 | puts("\nLets change contrast"); |
CaptainR | 11:3ebd2263f3e9 | 268 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 269 | contrast(DISABLE); |
CaptainR | 12:29f5ad896382 | 270 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 271 | contrast(ENABLE); |
CaptainR | 12:29f5ad896382 | 272 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 273 | cls(); |
CaptainR | 12:29f5ad896382 | 274 | |
CaptainR | 11:3ebd2263f3e9 | 275 | puts("\nLets change outline color "); |
CaptainR | 11:3ebd2263f3e9 | 276 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 277 | drawFilledCircle(50, 50, 20, Red); |
CaptainR | 11:3ebd2263f3e9 | 278 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 279 | outlineColor(White); |
CaptainR | 11:3ebd2263f3e9 | 280 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 281 | drawFilledCircle(100, 50, 20, Red); |
CaptainR | 11:3ebd2263f3e9 | 282 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 283 | cls(); |
CaptainR | 12:29f5ad896382 | 284 | |
CaptainR | 0:a5ef6bc3c2e8 | 285 | puts("\nLets change all the "); |
CaptainR | 2:81eaaa491a02 | 286 | textFgColor(Purple); |
CaptainR | 0:a5ef6bc3c2e8 | 287 | puts("PURPLE"); |
CaptainR | 2:81eaaa491a02 | 288 | textFgColor(Yellow); |
CaptainR | 0:a5ef6bc3c2e8 | 289 | puts(" bits to yellow"); |
CaptainR | 3:dcfbceb81fef | 290 | textFgColor(Green); // set Color back to green |
CaptainR | 0:a5ef6bc3c2e8 | 291 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 292 | changeColor(Purple, Yellow); |
CaptainR | 0:a5ef6bc3c2e8 | 293 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 294 | cls(); |
CaptainR | 12:29f5ad896382 | 295 | |
CaptainR | 0:a5ef6bc3c2e8 | 296 | puts("Lets draw some shapes:"); |
CaptainR | 3:dcfbceb81fef | 297 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 298 | drawCircle(100, 100, 20, Aqua); |
CaptainR | 3:dcfbceb81fef | 299 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 300 | drawFilledCircle(50, 50, 20, Red); |
CaptainR | 3:dcfbceb81fef | 301 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 302 | drawLine(20, 20, 100, 30, Blue); |
CaptainR | 3:dcfbceb81fef | 303 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 304 | drawRectangle(120, 20, 200, 60, Pink); |
CaptainR | 3:dcfbceb81fef | 305 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 306 | drawFilledRectangle(210, 0, 250, 80, Orange); |
CaptainR | 3:dcfbceb81fef | 307 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 308 | short xPolyline[3] = {10, 80, 180}; |
CaptainR | 3:dcfbceb81fef | 309 | short yPolyline[3] = {10, 200, 80}; |
CaptainR | 3:dcfbceb81fef | 310 | drawPolyline(3, xPolyline, yPolyline, Green); |
CaptainR | 3:dcfbceb81fef | 311 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 312 | short xPolygon[5] = {0, 30, 5, 50, 40}; |
CaptainR | 3:dcfbceb81fef | 313 | short yPolygon[5] = {50, 100, 220, 230, 170}; |
CaptainR | 3:dcfbceb81fef | 314 | drawPolygon(5, xPolygon, yPolygon, Grey); |
CaptainR | 3:dcfbceb81fef | 315 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 316 | short xFilledPolygon[5] = {260, 280, 290, 300, 255}; |
CaptainR | 3:dcfbceb81fef | 317 | short yFilledPolygon[5] = {0, 20, 35, 55, 22}; |
CaptainR | 3:dcfbceb81fef | 318 | drawFilledPolygon(5, xFilledPolygon, yFilledPolygon, White); |
CaptainR | 3:dcfbceb81fef | 319 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 320 | drawTriangle(70, 130, 90, 150, 110, 120, Cream); |
CaptainR | 3:dcfbceb81fef | 321 | wait_ms(SHORT_WAIT); |
CaptainR | 3:dcfbceb81fef | 322 | drawFilledTriangle(260, 50, 300, 90, 240, 120, Yellow); |
CaptainR | 3:dcfbceb81fef | 323 | wait_ms(SHORT_WAIT); |
CaptainR | 10:b959bb206e6b | 324 | drawElipse(200, 130, 20, 10, Olive); |
CaptainR | 10:b959bb206e6b | 325 | wait_ms(SHORT_WAIT); |
CaptainR | 10:b959bb206e6b | 326 | drawFilledElipse(200, 100, 30, 20, Navy); |
CaptainR | 12:29f5ad896382 | 327 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 328 | linePatern(10); |
CaptainR | 11:3ebd2263f3e9 | 329 | drawLine(200, 200, 100, 300, White); |
CaptainR | 11:3ebd2263f3e9 | 330 | wait_ms(LONG_WAIT); |
CaptainR | 4:50511ed54ab4 | 331 | cls(); |
CaptainR | 12:29f5ad896382 | 332 | |
CaptainR | 6:a1a85f2bc04b | 333 | /* |
CaptainR | 6:a1a85f2bc04b | 334 | // somehow after this function display stops (but the calculation is right) |
CaptainR | 4:50511ed54ab4 | 335 | puts("Lets calculate distance from point 0,0 on angle 40, 60 pixels away:"); |
CaptainR | 4:50511ed54ab4 | 336 | wait_ms(LONG_WAIT); |
CaptainR | 4:50511ed54ab4 | 337 | cls(); |
CaptainR | 4:50511ed54ab4 | 338 | calculateOrbit(40, 60); |
CaptainR | 6:a1a85f2bc04b | 339 | wait_ms(SHORT_WAIT); |
CaptainR | 6:a1a85f2bc04b | 340 | cls(); |
CaptainR | 6:a1a85f2bc04b | 341 | */ |
CaptainR | 12:29f5ad896382 | 342 | |
CaptainR | 6:a1a85f2bc04b | 343 | puts("Lets draw some pixels:"); |
CaptainR | 6:a1a85f2bc04b | 344 | wait_ms(LONG_WAIT); |
CaptainR | 12:29f5ad896382 | 345 | cls(); |
CaptainR | 12:29f5ad896382 | 346 | for (int i = 0; i <= 10; i++) { |
CaptainR | 12:29f5ad896382 | 347 | for (int j = 0; j <= 10; j++) { |
CaptainR | 12:29f5ad896382 | 348 | putPixel(i, j, Red); |
CaptainR | 12:29f5ad896382 | 349 | } |
CaptainR | 12:29f5ad896382 | 350 | } |
CaptainR | 6:a1a85f2bc04b | 351 | wait_ms(LONG_WAIT); |
CaptainR | 6:a1a85f2bc04b | 352 | cls(); |
CaptainR | 12:29f5ad896382 | 353 | |
CaptainR | 7:f064ae670553 | 354 | puts("Lets move origin point:"); |
CaptainR | 7:f064ae670553 | 355 | wait_ms(LONG_WAIT); |
CaptainR | 7:f064ae670553 | 356 | moveOrigin(100, 100); |
CaptainR | 7:f064ae670553 | 357 | puts("This is the new origin!"); |
CaptainR | 8:b634ac9c92f8 | 358 | wait_ms(LONG_WAIT); |
CaptainR | 8:b634ac9c92f8 | 359 | cls(); |
CaptainR | 12:29f5ad896382 | 360 | |
CaptainR | 8:b634ac9c92f8 | 361 | puts("Now draw line from here:"); |
CaptainR | 8:b634ac9c92f8 | 362 | wait_ms(SHORT_WAIT); |
CaptainR | 8:b634ac9c92f8 | 363 | lineTo(100, 100); |
CaptainR | 12:29f5ad896382 | 364 | wait_ms(LONG_WAIT); |
CaptainR | 8:b634ac9c92f8 | 365 | puts("To here!"); |
CaptainR | 8:b634ac9c92f8 | 366 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 367 | cls(); |
CaptainR | 12:29f5ad896382 | 368 | |
CaptainR | 9:32eb75c01e9d | 369 | puts("Change clipping window, to test it, we use changeColor function, that works only in clipping area:"); |
CaptainR | 9:32eb75c01e9d | 370 | wait_ms(LONG_WAIT); |
CaptainR | 12:29f5ad896382 | 371 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 372 | setClipWindow(0, 0, 200, 20); |
CaptainR | 9:32eb75c01e9d | 373 | changeColor(Green, Red); |
CaptainR | 9:32eb75c01e9d | 374 | puts("\n\n\rDone!!!!"); |
CaptainR | 9:32eb75c01e9d | 375 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 376 | puts("\n\n\rNow extend to here!"); |
CaptainR | 12:29f5ad896382 | 377 | wait_ms(LONG_WAIT); |
CaptainR | 9:32eb75c01e9d | 378 | extendClipRegion(); |
CaptainR | 9:32eb75c01e9d | 379 | changeColor(Green, Red); |
CaptainR | 9:32eb75c01e9d | 380 | puts("\n\n\rHow does it look?"); |
CaptainR | 9:32eb75c01e9d | 381 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 382 | cls(); |
CaptainR | 12:29f5ad896382 | 383 | |
CaptainR | 10:b959bb206e6b | 384 | puts("\nLets place a button:"); |
CaptainR | 10:b959bb206e6b | 385 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 386 | cls(); |
CaptainR | 12:29f5ad896382 | 387 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 10:b959bb206e6b | 388 | puts("\n\n\n\nDid it work?"); |
CaptainR | 10:b959bb206e6b | 389 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 390 | cls(); |
CaptainR | 12:29f5ad896382 | 391 | |
CaptainR | 11:3ebd2263f3e9 | 392 | puts("\nNow lets change bevel width"); |
CaptainR | 11:3ebd2263f3e9 | 393 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 394 | if (bevelWidth(0)) { |
CaptainR | 11:3ebd2263f3e9 | 395 | puts("\nNo bevel"); |
CaptainR | 12:29f5ad896382 | 396 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 397 | } |
CaptainR | 12:29f5ad896382 | 398 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 399 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 400 | if (bevelWidth(1)) { |
CaptainR | 11:3ebd2263f3e9 | 401 | puts("\nbevel 1"); |
CaptainR | 12:29f5ad896382 | 402 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 403 | } |
CaptainR | 12:29f5ad896382 | 404 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 405 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 406 | if (bevelWidth(10)) { |
CaptainR | 11:3ebd2263f3e9 | 407 | puts("\nbevel 10"); |
CaptainR | 12:29f5ad896382 | 408 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 409 | } |
CaptainR | 12:29f5ad896382 | 410 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 411 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 412 | if (bevelWidth(16)) { |
CaptainR | 11:3ebd2263f3e9 | 413 | puts("\nbevel 16"); |
CaptainR | 12:29f5ad896382 | 414 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 415 | } |
CaptainR | 12:29f5ad896382 | 416 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 417 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 418 | if (bevelWidth(2)) { |
CaptainR | 11:3ebd2263f3e9 | 419 | puts("\nbevel 2"); |
CaptainR | 12:29f5ad896382 | 420 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 421 | } |
CaptainR | 12:29f5ad896382 | 422 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 423 | cls(); |
CaptainR | 12:29f5ad896382 | 424 | |
CaptainR | 10:b959bb206e6b | 425 | puts("\nNow lets change bevel shadow level"); |
CaptainR | 10:b959bb206e6b | 426 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 427 | if (bevelShadow(0)) { |
CaptainR | 11:3ebd2263f3e9 | 428 | puts("\nNo shadow"); |
CaptainR | 12:29f5ad896382 | 429 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 430 | } |
CaptainR | 10:b959bb206e6b | 431 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 432 | if (bevelShadow(1)) { |
CaptainR | 11:3ebd2263f3e9 | 433 | puts("\nShadow 1"); |
CaptainR | 12:29f5ad896382 | 434 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 435 | } |
CaptainR | 10:b959bb206e6b | 436 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 437 | if (bevelShadow(2)) { |
CaptainR | 11:3ebd2263f3e9 | 438 | puts("\nShadow 2"); |
CaptainR | 12:29f5ad896382 | 439 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 440 | } |
CaptainR | 10:b959bb206e6b | 441 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 442 | if (bevelShadow(3)) { |
CaptainR | 11:3ebd2263f3e9 | 443 | puts("\nShadow 3"); |
CaptainR | 12:29f5ad896382 | 444 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 445 | } |
CaptainR | 11:3ebd2263f3e9 | 446 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 447 | if (bevelShadow(4)) { |
CaptainR | 11:3ebd2263f3e9 | 448 | puts("\nShadow 4"); |
CaptainR | 12:29f5ad896382 | 449 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 450 | } |
CaptainR | 10:b959bb206e6b | 451 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 452 | if (bevelShadow(5)) { |
CaptainR | 11:3ebd2263f3e9 | 453 | puts("\nShadow 5"); |
CaptainR | 12:29f5ad896382 | 454 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 455 | } |
CaptainR | 10:b959bb206e6b | 456 | wait_ms(SHORT_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 457 | if (bevelShadow(1)) { |
CaptainR | 11:3ebd2263f3e9 | 458 | puts("\nShadow 1"); |
CaptainR | 12:29f5ad896382 | 459 | drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me"); |
CaptainR | 11:3ebd2263f3e9 | 460 | } |
CaptainR | 12:29f5ad896382 | 461 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 462 | cls(); |
CaptainR | 12:29f5ad896382 | 463 | |
CaptainR | 10:b959bb206e6b | 464 | puts("\nLets place a panel:"); |
CaptainR | 10:b959bb206e6b | 465 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 466 | cls(); |
CaptainR | 12:29f5ad896382 | 467 | drawPanel(RECESSED, 0, 0, 200, 20, Cream); |
CaptainR | 12:29f5ad896382 | 468 | wait_ms(SHORT_WAIT); |
CaptainR | 10:b959bb206e6b | 469 | puts("\nDid it work?"); |
CaptainR | 10:b959bb206e6b | 470 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 471 | cls(); |
CaptainR | 12:29f5ad896382 | 472 | |
CaptainR | 10:b959bb206e6b | 473 | puts("\nLets place a slider:"); |
CaptainR | 10:b959bb206e6b | 474 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 475 | cls(); |
CaptainR | 10:b959bb206e6b | 476 | drawSlider(RAISED, 30, 40, 210, 90, Violet, 100, 0); |
CaptainR | 10:b959bb206e6b | 477 | puts("\nDid it work?"); |
CaptainR | 10:b959bb206e6b | 478 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 479 | cls(); |
CaptainR | 12:29f5ad896382 | 480 | |
CaptainR | 10:b959bb206e6b | 481 | puts("\nThis particular function is going to copy a specified portion of the creen and paste it somewhere else!"); |
CaptainR | 10:b959bb206e6b | 482 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 483 | wait_ms(LONG_WAIT); |
CaptainR | 12:29f5ad896382 | 484 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 485 | //cls(); |
CaptainR | 10:b959bb206e6b | 486 | screenCopyPaste(0, 0, 50, 100, 200, 50); |
CaptainR | 10:b959bb206e6b | 487 | puts("\nDid it work?"); |
CaptainR | 10:b959bb206e6b | 488 | wait_ms(LONG_WAIT); |
CaptainR | 10:b959bb206e6b | 489 | cls(); |
CaptainR | 12:29f5ad896382 | 490 | |
CaptainR | 11:3ebd2263f3e9 | 491 | puts("\nLets get Xmax:"); |
CaptainR | 11:3ebd2263f3e9 | 492 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 493 | short Xmax = getGraphics(currentXMax); |
CaptainR | 11:3ebd2263f3e9 | 494 | puts("\nLets get Ymax:"); |
CaptainR | 11:3ebd2263f3e9 | 495 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 496 | short Ymax = getGraphics(currentYMax); |
CaptainR | 11:3ebd2263f3e9 | 497 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 498 | pc.printf("\nCurrent orientation xMax = %i, yMax = %i\n\r", Xmax, Ymax); |
CaptainR | 12:29f5ad896382 | 499 | cls(); |
CaptainR | 21:ea68a8a3cea4 | 500 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 501 | } |
CaptainR | 0:a5ef6bc3c2e8 | 502 | |
CaptainR | 0:a5ef6bc3c2e8 | 503 | //************************************************************************** |
CaptainR | 0:a5ef6bc3c2e8 | 504 | // Demo program that goes through main functions |
CaptainR | 0:a5ef6bc3c2e8 | 505 | //************************************************************************** |
CaptainR | 3:dcfbceb81fef | 506 | void PICASO_4DGL :: mainDemo() { |
CaptainR | 0:a5ef6bc3c2e8 | 507 | |
CaptainR | 0:a5ef6bc3c2e8 | 508 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 509 | puts("This is the main functions demo"); |
CaptainR | 0:a5ef6bc3c2e8 | 510 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 511 | cls(); |
CaptainR | 12:29f5ad896382 | 512 | /* |
CaptainR | 0:a5ef6bc3c2e8 | 513 | puts("\nBaudrates:"); |
CaptainR | 0:a5ef6bc3c2e8 | 514 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 515 | cls(); |
CaptainR | 12:29f5ad896382 | 516 | |
CaptainR | 0:a5ef6bc3c2e8 | 517 | baudrate(4800); |
CaptainR | 0:a5ef6bc3c2e8 | 518 | puts("\n4800"); |
CaptainR | 0:a5ef6bc3c2e8 | 519 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 520 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 521 | baudrate(9600); |
CaptainR | 0:a5ef6bc3c2e8 | 522 | puts("\n9600"); |
CaptainR | 0:a5ef6bc3c2e8 | 523 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 524 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 525 | baudrate(14400); |
CaptainR | 0:a5ef6bc3c2e8 | 526 | puts("\n14400"); |
CaptainR | 0:a5ef6bc3c2e8 | 527 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 528 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 529 | baudrate(19200); |
CaptainR | 0:a5ef6bc3c2e8 | 530 | puts("\n19200"); |
CaptainR | 0:a5ef6bc3c2e8 | 531 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 532 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 533 | baudrate(38400); |
CaptainR | 0:a5ef6bc3c2e8 | 534 | puts("\n38400"); |
CaptainR | 0:a5ef6bc3c2e8 | 535 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 536 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 537 | baudrate(56000); |
CaptainR | 0:a5ef6bc3c2e8 | 538 | puts("\n56000"); |
CaptainR | 0:a5ef6bc3c2e8 | 539 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 540 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 541 | baudrate(57600); |
CaptainR | 0:a5ef6bc3c2e8 | 542 | puts("\n57600"); |
CaptainR | 0:a5ef6bc3c2e8 | 543 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 544 | cls(); |
CaptainR | 12:29f5ad896382 | 545 | baudrate(9600); |
CaptainR | 12:29f5ad896382 | 546 | puts("\n9600"); |
CaptainR | 2:81eaaa491a02 | 547 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 548 | cls(); |
CaptainR | 12:29f5ad896382 | 549 | */ |
CaptainR | 0:a5ef6bc3c2e8 | 550 | puts("\nOrientation:"); |
CaptainR | 0:a5ef6bc3c2e8 | 551 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 552 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 553 | screenMode(landscape); |
CaptainR | 0:a5ef6bc3c2e8 | 554 | puts("landscape"); |
CaptainR | 0:a5ef6bc3c2e8 | 555 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 556 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 557 | screenMode(landscapeRew); |
CaptainR | 0:a5ef6bc3c2e8 | 558 | puts("landscape rewersed"); |
CaptainR | 0:a5ef6bc3c2e8 | 559 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 560 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 561 | screenMode(portrait); |
CaptainR | 0:a5ef6bc3c2e8 | 562 | puts("portrait"); |
CaptainR | 0:a5ef6bc3c2e8 | 563 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 564 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 565 | screenMode(portraitRew); |
CaptainR | 0:a5ef6bc3c2e8 | 566 | puts("portrait rewersed"); |
CaptainR | 0:a5ef6bc3c2e8 | 567 | wait_ms(LONG_WAIT); |
CaptainR | 11:3ebd2263f3e9 | 568 | screenMode(landscape); // set back screen to landscape |
CaptainR | 0:a5ef6bc3c2e8 | 569 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 570 | |
CaptainR | 0:a5ef6bc3c2e8 | 571 | } |
CaptainR | 0:a5ef6bc3c2e8 | 572 | |
CaptainR | 0:a5ef6bc3c2e8 | 573 | //************************************************************************** |
CaptainR | 0:a5ef6bc3c2e8 | 574 | // Demo program that goes through text based functions |
CaptainR | 0:a5ef6bc3c2e8 | 575 | //************************************************************************** |
CaptainR | 3:dcfbceb81fef | 576 | void PICASO_4DGL :: textDemo() { |
CaptainR | 0:a5ef6bc3c2e8 | 577 | |
CaptainR | 0:a5ef6bc3c2e8 | 578 | cls(); |
CaptainR | 11:3ebd2263f3e9 | 579 | screenMode(landscape); // set screen to landscape |
CaptainR | 0:a5ef6bc3c2e8 | 580 | puts("This is the Text functions demo"); |
CaptainR | 0:a5ef6bc3c2e8 | 581 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 582 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 583 | |
CaptainR | 0:a5ef6bc3c2e8 | 584 | puts("\nText attributes:"); |
CaptainR | 0:a5ef6bc3c2e8 | 585 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 586 | //cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 587 | puts("\n\n"); |
CaptainR | 2:81eaaa491a02 | 588 | textAttributes(bold); |
CaptainR | 0:a5ef6bc3c2e8 | 589 | puts("\nBOLD"); |
CaptainR | 0:a5ef6bc3c2e8 | 590 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 591 | textAttributes(bold + italic); |
CaptainR | 0:a5ef6bc3c2e8 | 592 | puts("\nBOLD & ITALIC"); |
CaptainR | 0:a5ef6bc3c2e8 | 593 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 594 | textAttributes(bold + italic + inverse); |
CaptainR | 0:a5ef6bc3c2e8 | 595 | puts("\nBOLD & ITALIC & INVERSE"); |
CaptainR | 0:a5ef6bc3c2e8 | 596 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 597 | textAttributes(bold + italic + inverse + underline); |
CaptainR | 0:a5ef6bc3c2e8 | 598 | puts("\nBOLD & ITALIC & INVERSE & UNDERLINE"); |
CaptainR | 0:a5ef6bc3c2e8 | 599 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 600 | textAttributes(DISABLE); // set everything back to normal |
CaptainR | 0:a5ef6bc3c2e8 | 601 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 602 | |
CaptainR | 0:a5ef6bc3c2e8 | 603 | puts("\nText modes:"); |
CaptainR | 0:a5ef6bc3c2e8 | 604 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 605 | cls(); |
CaptainR | 2:81eaaa491a02 | 606 | textBold(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 607 | puts("\nBOLD:"); |
CaptainR | 0:a5ef6bc3c2e8 | 608 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 609 | textBold(DISABLE); |
CaptainR | 2:81eaaa491a02 | 610 | textInverse(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 611 | puts("\nINVERSE:"); |
CaptainR | 0:a5ef6bc3c2e8 | 612 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 613 | textInverse(DISABLE); |
CaptainR | 2:81eaaa491a02 | 614 | textItalic(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 615 | puts("\nITALIC:"); |
CaptainR | 0:a5ef6bc3c2e8 | 616 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 617 | textItalic(DISABLE); |
CaptainR | 2:81eaaa491a02 | 618 | textUnderline(ENABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 619 | puts("\nUNDERLINE:"); |
CaptainR | 0:a5ef6bc3c2e8 | 620 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 621 | textUnderline(DISABLE); |
CaptainR | 0:a5ef6bc3c2e8 | 622 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 623 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 624 | |
CaptainR | 0:a5ef6bc3c2e8 | 625 | puts("\nText gaps:"); |
CaptainR | 0:a5ef6bc3c2e8 | 626 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 627 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 628 | if (textXGap(0) == 1) puts("\nX gap: 0"); |
CaptainR | 0:a5ef6bc3c2e8 | 629 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 630 | if (textXGap(1) == 1) puts("\nX gap: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 631 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 632 | if (textXGap(2) == 1) puts("\nX gap: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 633 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 634 | if (textXGap(3) == 1) puts("\nX gap: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 635 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 636 | if (textXGap(4) == 1) puts("\nX gap: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 637 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 638 | if (textXGap(5) == 1) puts("\nX gap: 5"); |
CaptainR | 0:a5ef6bc3c2e8 | 639 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 640 | if (textXGap(6) == 1) puts("\nX gap: 6"); |
CaptainR | 0:a5ef6bc3c2e8 | 641 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 642 | puts("\n"); |
CaptainR | 0:a5ef6bc3c2e8 | 643 | textXGap(0); |
CaptainR | 0:a5ef6bc3c2e8 | 644 | if (textYGap(0) == 1) puts("\nY gap: 0"); |
CaptainR | 0:a5ef6bc3c2e8 | 645 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 646 | if (textYGap(1) == 1) puts("\nY gap: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 647 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 648 | if (textYGap(2) == 1) puts("\nY gap: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 649 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 650 | if (textYGap(3) == 1) puts("\nY gap: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 651 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 652 | if (textYGap(4) == 1) puts("\nY gap: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 653 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 654 | if (textYGap(5) == 1) puts("\nY gap: 5"); |
CaptainR | 0:a5ef6bc3c2e8 | 655 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 656 | if (textYGap(6) == 1) puts("\nY gap: 6"); |
CaptainR | 0:a5ef6bc3c2e8 | 657 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 658 | textYGap(0); |
CaptainR | 0:a5ef6bc3c2e8 | 659 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 660 | |
CaptainR | 0:a5ef6bc3c2e8 | 661 | puts("Text width:"); |
CaptainR | 0:a5ef6bc3c2e8 | 662 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 663 | if (textWidth(1) == 1) puts("\nWidth: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 664 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 665 | if (textWidth(2) == 1) puts("\nWidth: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 666 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 667 | if (textWidth(3) == 1) puts("\nWidth: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 668 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 669 | if (textWidth(4) == 1) puts("\nWidth: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 670 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 671 | textWidth(1); |
CaptainR | 0:a5ef6bc3c2e8 | 672 | puts("\nText height:"); |
CaptainR | 0:a5ef6bc3c2e8 | 673 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 674 | //cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 675 | if (textHeight(1) == 1) puts("\nHeight: 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 676 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 677 | if (textHeight(2) == 1) puts("\nHeight: 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 678 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 679 | if (textHeight(3) == 1) puts("\nHeight: 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 680 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 681 | if (textHeight(4) == 1) puts("\nHeight: 4"); |
CaptainR | 0:a5ef6bc3c2e8 | 682 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 683 | textHeight(1); |
CaptainR | 0:a5ef6bc3c2e8 | 684 | cls(); |
CaptainR | 2:81eaaa491a02 | 685 | |
CaptainR | 0:a5ef6bc3c2e8 | 686 | puts("Fonts:"); |
CaptainR | 0:a5ef6bc3c2e8 | 687 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 688 | cls(); |
CaptainR | 2:81eaaa491a02 | 689 | setFont(font1); |
CaptainR | 0:a5ef6bc3c2e8 | 690 | puts("\nThis is Font 1"); |
CaptainR | 0:a5ef6bc3c2e8 | 691 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 692 | setFont(font2); |
CaptainR | 0:a5ef6bc3c2e8 | 693 | puts("\nThis is Font 2"); |
CaptainR | 0:a5ef6bc3c2e8 | 694 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 695 | setFont(font3); |
CaptainR | 0:a5ef6bc3c2e8 | 696 | puts("\nThis is Font 3"); |
CaptainR | 0:a5ef6bc3c2e8 | 697 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 698 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 699 | |
CaptainR | 2:81eaaa491a02 | 700 | |
CaptainR | 11:3ebd2263f3e9 | 701 | screenMode(portrait); |
CaptainR | 0:a5ef6bc3c2e8 | 702 | puts("\nText Background colors:"); |
CaptainR | 0:a5ef6bc3c2e8 | 703 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 704 | cls(); |
CaptainR | 2:81eaaa491a02 | 705 | textBgColor(Black); |
CaptainR | 3:dcfbceb81fef | 706 | puts("\nBG Color = BLACK"); |
CaptainR | 0:a5ef6bc3c2e8 | 707 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 708 | textBgColor(Navy); |
CaptainR | 3:dcfbceb81fef | 709 | puts("\nBG Color = NAVY"); |
CaptainR | 0:a5ef6bc3c2e8 | 710 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 711 | textFgColor(Black); |
CaptainR | 2:81eaaa491a02 | 712 | textBgColor(DGreen); |
CaptainR | 3:dcfbceb81fef | 713 | puts("\nBG Color = DARK GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 714 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 715 | textBgColor(DCyan); |
CaptainR | 3:dcfbceb81fef | 716 | puts("\nBG Color = DARK CYAN"); |
CaptainR | 0:a5ef6bc3c2e8 | 717 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 718 | textBgColor(Purple); |
CaptainR | 3:dcfbceb81fef | 719 | puts("\nBG Color = PURPLE"); |
CaptainR | 0:a5ef6bc3c2e8 | 720 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 721 | textBgColor(Olive); |
CaptainR | 3:dcfbceb81fef | 722 | puts("\nBG Color = OLIVE"); |
CaptainR | 0:a5ef6bc3c2e8 | 723 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 724 | textBgColor(Grey); |
CaptainR | 3:dcfbceb81fef | 725 | puts("\nBG Color = GREY"); |
CaptainR | 0:a5ef6bc3c2e8 | 726 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 727 | textBgColor(Blue); |
CaptainR | 3:dcfbceb81fef | 728 | puts("\nBG Color = BLUE"); |
CaptainR | 0:a5ef6bc3c2e8 | 729 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 730 | textBgColor(Green); |
CaptainR | 3:dcfbceb81fef | 731 | puts("\nBG Color = GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 732 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 733 | textBgColor(Red); |
CaptainR | 3:dcfbceb81fef | 734 | puts("\nBG Color = RED"); |
CaptainR | 0:a5ef6bc3c2e8 | 735 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 736 | textBgColor(Yellow); |
CaptainR | 3:dcfbceb81fef | 737 | puts("\nBG Color = YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 738 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 739 | textBgColor(GYellow); |
CaptainR | 3:dcfbceb81fef | 740 | puts("\nBG Color = GREEN YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 741 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 742 | textBgColor(White); |
CaptainR | 3:dcfbceb81fef | 743 | puts("\nBG Color = WHITE"); |
CaptainR | 0:a5ef6bc3c2e8 | 744 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 745 | textBgColor(Orange); |
CaptainR | 3:dcfbceb81fef | 746 | puts("\nBG Color = ORANGE"); |
CaptainR | 0:a5ef6bc3c2e8 | 747 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 748 | textBgColor(Pink); |
CaptainR | 3:dcfbceb81fef | 749 | puts("\nBG Color = PINK"); |
CaptainR | 0:a5ef6bc3c2e8 | 750 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 751 | textBgColor(Violet); |
CaptainR | 3:dcfbceb81fef | 752 | puts("\nBG Color = VIOLET"); |
CaptainR | 0:a5ef6bc3c2e8 | 753 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 754 | textBgColor(Aqua); |
CaptainR | 3:dcfbceb81fef | 755 | puts("\nBG Color = AQUA"); |
CaptainR | 0:a5ef6bc3c2e8 | 756 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 757 | textBgColor(Cream); |
CaptainR | 3:dcfbceb81fef | 758 | puts("\nBG Color = CREAM"); |
CaptainR | 0:a5ef6bc3c2e8 | 759 | wait_ms(LONG_WAIT); |
CaptainR | 3:dcfbceb81fef | 760 | textBgColor(Black); // set Color back |
CaptainR | 3:dcfbceb81fef | 761 | textFgColor(Green); // set Color back |
CaptainR | 0:a5ef6bc3c2e8 | 762 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 763 | |
CaptainR | 12:29f5ad896382 | 764 | screenMode(landscape); |
CaptainR | 0:a5ef6bc3c2e8 | 765 | puts("Lets try moving cursor..."); |
CaptainR | 0:a5ef6bc3c2e8 | 766 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 767 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 768 | if (moveCursor(5, 5) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 769 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 770 | if (moveCursor(10, 10) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 771 | wait_ms(SHORT_WAIT); |
CaptainR | 12:29f5ad896382 | 772 | screenMode(portraitRew); |
CaptainR | 0:a5ef6bc3c2e8 | 773 | if (moveCursor(50, 50) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 774 | wait_ms(SHORT_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 775 | if (moveCursor(19, 29) == 1) puts("+"); |
CaptainR | 0:a5ef6bc3c2e8 | 776 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 777 | cls(); |
CaptainR | 0:a5ef6bc3c2e8 | 778 | |
CaptainR | 0:a5ef6bc3c2e8 | 779 | |
CaptainR | 11:3ebd2263f3e9 | 780 | screenMode(portrait); |
CaptainR | 3:dcfbceb81fef | 781 | puts("\nText Foreground Colors:"); |
CaptainR | 0:a5ef6bc3c2e8 | 782 | wait_ms(LONG_WAIT); |
CaptainR | 0:a5ef6bc3c2e8 | 783 | cls(); |
CaptainR | 2:81eaaa491a02 | 784 | textBgColor(White); |
CaptainR | 2:81eaaa491a02 | 785 | textFgColor(Black); |
CaptainR | 3:dcfbceb81fef | 786 | puts("\nFG Color = BLACK"); |
CaptainR | 2:81eaaa491a02 | 787 | textBgColor(Black); |
CaptainR | 0:a5ef6bc3c2e8 | 788 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 789 | textFgColor(Navy); |
CaptainR | 3:dcfbceb81fef | 790 | puts("\nFG Color = NAVY"); |
CaptainR | 0:a5ef6bc3c2e8 | 791 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 792 | textFgColor(DGreen); |
CaptainR | 3:dcfbceb81fef | 793 | puts("\nFG Color = DARK GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 794 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 795 | textFgColor(DCyan); |
CaptainR | 3:dcfbceb81fef | 796 | puts("\nFG Color = DARK CYAN"); |
CaptainR | 0:a5ef6bc3c2e8 | 797 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 798 | textFgColor(Purple); |
CaptainR | 3:dcfbceb81fef | 799 | puts("\nFG Color = PURPLE"); |
CaptainR | 0:a5ef6bc3c2e8 | 800 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 801 | textFgColor(Olive); |
CaptainR | 3:dcfbceb81fef | 802 | puts("\nFG Color = OLIVE"); |
CaptainR | 0:a5ef6bc3c2e8 | 803 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 804 | textFgColor(Grey); |
CaptainR | 3:dcfbceb81fef | 805 | puts("\nFG Color = GREY"); |
CaptainR | 0:a5ef6bc3c2e8 | 806 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 807 | textFgColor(Blue); |
CaptainR | 3:dcfbceb81fef | 808 | puts("\nFG Color = BLUE"); |
CaptainR | 0:a5ef6bc3c2e8 | 809 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 810 | textFgColor(Green); |
CaptainR | 3:dcfbceb81fef | 811 | puts("\nFG Color = GREEN"); |
CaptainR | 0:a5ef6bc3c2e8 | 812 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 813 | textFgColor(Red); |
CaptainR | 3:dcfbceb81fef | 814 | puts("\nFG Color = RED"); |
CaptainR | 0:a5ef6bc3c2e8 | 815 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 816 | textFgColor(Yellow); |
CaptainR | 3:dcfbceb81fef | 817 | puts("\nFG Color = YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 818 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 819 | textFgColor(GYellow); |
CaptainR | 3:dcfbceb81fef | 820 | puts("\nFG Color = GREEN YELLOW"); |
CaptainR | 0:a5ef6bc3c2e8 | 821 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 822 | textFgColor(White); |
CaptainR | 3:dcfbceb81fef | 823 | puts("\nFG Color = WHITE"); |
CaptainR | 0:a5ef6bc3c2e8 | 824 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 825 | textFgColor(Orange); |
CaptainR | 3:dcfbceb81fef | 826 | puts("\nFG Color = ORANGE"); |
CaptainR | 0:a5ef6bc3c2e8 | 827 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 828 | textFgColor(Pink); |
CaptainR | 3:dcfbceb81fef | 829 | puts("\nFG Color = PINK"); |
CaptainR | 0:a5ef6bc3c2e8 | 830 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 831 | textFgColor(Violet); |
CaptainR | 3:dcfbceb81fef | 832 | puts("\nFG Color = VIOLET"); |
CaptainR | 0:a5ef6bc3c2e8 | 833 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 834 | textFgColor(Aqua); |
CaptainR | 3:dcfbceb81fef | 835 | puts("\nFG Color = AQUA"); |
CaptainR | 0:a5ef6bc3c2e8 | 836 | wait_ms(SHORT_WAIT); |
CaptainR | 2:81eaaa491a02 | 837 | textFgColor(Cream); |
CaptainR | 3:dcfbceb81fef | 838 | puts("\nFG Color = CREAM"); |
CaptainR | 2:81eaaa491a02 | 839 | wait_ms(LONG_WAIT); |
CaptainR | 3:dcfbceb81fef | 840 | textFgColor(Green); // set Color back |
CaptainR | 21:ea68a8a3cea4 | 841 | wait_ms(LONG_WAIT); |
CaptainR | 2:81eaaa491a02 | 842 | |
CaptainR | 2:81eaaa491a02 | 843 | |
CaptainR | 22:cea582ea74c1 | 844 | } |
CaptainR | 22:cea582ea74c1 | 845 | |
CaptainR | 26:c6a803706a42 | 846 | void clearBuf(char *str, int size) { |
CaptainR | 22:cea582ea74c1 | 847 | int i; |
CaptainR | 26:c6a803706a42 | 848 | for (i = 0; i < size; i++) { |
CaptainR | 22:cea582ea74c1 | 849 | str[i] = 0; |
CaptainR | 26:c6a803706a42 | 850 | } |
CaptainR | 0:a5ef6bc3c2e8 | 851 | } |