Components and supplies
Arduino R4 UNO
Apps and platforms
Arduino IDE
Project description
Code
real time clock
cpp
code of the real time clock for arduino uno r4
1/* 2Title: Real Time Clock for Arduino Uno R4 3Description: Code displays real time clock on LED matrix of Arduino UNO R4. 4It uses RTC, LED matrix and "LedMatrixNumbers.h" library to display numbers on LED Matrix. 5 6code automatically sets RTC clock using compile time parameter "__TIME__", 7which means that you don't need to adjust clock on every upload. 8 9Since LED Matrix is 8x12, it was difficult to make it readable, 10because of this it displays hours on top left and minutes on bottom right. 11"ShiftRow" and "ShiftCol", variables are used to shift displayed numbers on LED Matrix, 12were coordinate 0,0 is top left LED of the matrix. 13 14 158th row is used to indicate seconds pass which increases in every 5 second (60 / 12 (LED Column) = 5) 16 17I hope you will like it!!! :) 18 19Feel free to modify and adjust it! 20 21Author: Pavle Tsotskolauri 22E-Mail: pavle.tsotskolauri@tsu.ge 23Institute: Tbilisi State Unviersity 24 25*/ 26 27#include "RTC.h" 28#include "Arduino_LED_Matrix.h" 29#include "LedMatrixNumbers.h" 30 31ArduinoLEDMatrix matrix; 32#define PROGRAM_LOAD_DELAY 6 33 34void displayClock(int time, int shiftRow, int shiftCol) 35{ 36 switch (time) 37 { 38 case 0: 39 zeroSmall(shiftRow, shiftCol); 40 break; 41 case 1: 42 oneSmall(shiftRow, shiftCol); 43 break; 44 case 2: 45 twoSmall(shiftRow, shiftCol); 46 break; 47 case 3: 48 threeSmall(shiftRow, shiftCol); 49 break; 50 case 4: 51 fourSmall(shiftRow, shiftCol); 52 break; 53 case 5: 54 fiveSmall(shiftRow, shiftCol); 55 break; 56 case 6: 57 sixSmall(shiftRow, shiftCol); 58 break; 59 case 7: 60 sevenSmall(shiftRow, shiftCol); 61 break; 62 case 8: 63 eightSmall(shiftRow, shiftCol); 64 break; 65 case 9: 66 nineSmall(shiftRow, shiftCol); 67 break; 68 default: clear(); 69 } 70 matrix.renderBitmap(frame, 8, 12); 71} 72 73 74void secondsIndicator(int second) 75{ 76 for(int i = 0; i < 12; i++) 77 { 78 frame[7][i] = 0; 79 } 80 81 if (second >= 5) frame[7][0] = 1; 82 if (second >= 10) frame[7][1] = 1; 83 if (second >= 15) frame[7][2] = 1; 84 if (second >= 20) frame[7][3] = 1; 85 if (second >= 25) frame[7][4] = 1; 86 if (second >= 30) frame[7][5] = 1; 87 if (second >= 35) frame[7][6] = 1; 88 if (second >= 40) frame[7][7] = 1; 89 if (second >= 45) frame[7][8] = 1; 90 if (second >= 50) frame[7][9] = 1; 91 if (second >= 55) frame[7][10] = 1; 92 if (second >= 59) frame[7][11] = 1; 93 94 matrix.renderBitmap(frame, 8, 12); 95} 96 97void setup() { 98 Serial.begin(9600); 99 matrix.begin(); 100 101 const char date[9] = __TIME__; 102 String mydate = String(date); 103 String hour = mydate.substring(0, 2); 104 String minute = mydate.substring(3, 5); 105 String second = mydate.substring(6, 8); 106 107 RTC.begin(); 108 RTCTime startTime(21, Month::OCTOBER, 2023, hour.toInt(), minute.toInt(), second.toInt(), DayOfWeek::MONDAY, SaveLight::SAVING_TIME_ACTIVE); 109 RTC.setTime(startTime); 110} 111 112void loop() { 113 RTCTime currentTime; 114 115 // Get current time from RTC 116 RTC.getTime(currentTime); 117 118 // // Print out date (DD/MM//YYYY) 119 // Serial.print(currentTime.getDayOfMonth()); 120 // Serial.print("/"); 121 // Serial.print(Month2int(currentTime.getMonth())); 122 // Serial.print("/"); 123 // Serial.print(currentTime.getYear()); 124 // Serial.print(" - "); 125 126 // // Print time (HH/MM/SS) 127 // Serial.print(currentTime.getHour()); 128 // Serial.print(":"); 129 // Serial.print(currentTime.getMinutes()); 130 // Serial.print(":"); 131 // Serial.println(currentTime.getSeconds()%10); 132 133 clear(); 134 // Hour Display 135 displayClock(currentTime.getHour() / 10, 0, 0); 136 displayClock(currentTime.getHour() % 10, 0, 3); 137 // Minutes Display 138 displayClock(currentTime.getMinutes() / 10, 2, 6); 139 displayClock(currentTime.getMinutes() % 10, 2, 9); 140 141 // Seconds Display 142 // displayClock(currentTime.getSeconds()/10, 2, 6); 143 // displayClock(currentTime.getSeconds()%10, 2, 9); 144 145 secondsIndicator(currentTime.getSeconds()); 146 147 148 delay(1000); 149}
LedMatrixNumbers.h
cpp
LedMatrixNumbers.h library used to display numbers
1uint8_t frame[8][12] = { 2 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 3 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 4 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 5 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 6 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 7 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 8 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 9 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 10 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 11 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 12 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 13 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 14 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 15 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 16 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 17 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 18}; 19 20void clear() 21{ 22 for(int i = 0; i < 8; i++) 23 { 24 for(int j = 0; j < 12; j++) 25 { 26 frame[i][j] = 0; 27 } 28 } 29} 30 31void zero() 32{ 33 // { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, 34 // { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 }, 35 // { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 36 // { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 37 // { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 38 // { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 39 // { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 }, 40 // { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 } 41 frame[0][4] = 1; 42 frame[0][5] = 1; 43 frame[0][6] = 1; 44 frame[1][3] = 1; 45 frame[1][7] = 1; 46 frame[2][2] = 1; 47 frame[2][8] = 1; 48 frame[3][2] = 1; 49 frame[3][8] = 1; 50 frame[4][2] = 1; 51 frame[4][8] = 1; 52 frame[5][2] = 1; 53 frame[5][8] = 1; 54 frame[6][3] = 1; 55 frame[6][7] = 1; 56 frame[7][4] = 1; 57 frame[7][5] = 1; 58 frame[7][6] = 1; 59} 60 61 62 63void one() 64{ 65 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, 66 // { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, 67 // { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 }, 68 // { 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 }, 69 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, 70 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, 71 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, 72 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } 73 frame[0][6] = 1; 74 frame[1][5] = 1; 75 frame[1][6] = 1; 76 frame[2][4] = 1; 77 frame[2][6] = 1; 78 frame[3][3] = 1; 79 frame[3][6] = 1; 80 frame[4][6] = 1; 81 frame[5][6] = 1; 82 frame[6][6] = 1; 83 frame[7][6] = 1; 84} 85 86void two() 87{ 88 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 89 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 90 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 91 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 92 // { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, 93 // { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, 94 // { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, 95 // { 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 } 96 frame[0][4] = 1; 97 frame[0][5] = 1; 98 frame[0][6] = 1; 99 frame[0][7] = 1; 100 frame[1][3] = 1; 101 frame[1][8] = 1; 102 frame[2][3] = 1; 103 frame[2][8] = 1; 104 frame[3][7] = 1; 105 frame[4][6] = 1; 106 frame[5][5] = 1; 107 frame[6][4] = 1; 108 frame[7][3] = 1; 109 frame[7][4] = 1; 110 frame[7][5] = 1; 111 frame[7][6] = 1; 112 frame[7][7] = 1; 113 frame[7][8] = 1; 114} 115 116void three() 117{ 118 // { 0, 0, 0, , 1, 1, 1, 1, 0, 0, 0, 0 }, 119 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 120 // { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 121 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 122 // { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 123 // { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 124 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 125 // { 0, 0, 0, , 1, 1, 1, 1, 0, 0, 0, 0 } 126 frame[0][4] = 1; 127 frame[0][5] = 1; 128 frame[0][6] = 1; 129 frame[0][7] = 1; 130 frame[1][3] = 1; 131 frame[1][8] = 1; 132 frame[2][8] = 1; 133 frame[3][4] = 1; 134 frame[3][5] = 1; 135 frame[3][6] = 1; 136 frame[3][7] = 1; 137 frame[4][8] = 1; 138 frame[5][8] = 1; 139 frame[6][3] = 1; 140 frame[6][8] = 1; 141 frame[7][4] = 1; 142 frame[7][5] = 1; 143 frame[7][6] = 1; 144 frame[7][7] = 1; 145} 146 147void four() 148{ 149 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 150 // { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 }, 151 // { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 }, 152 // { 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 }, 153 // { 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 }, 154 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 155 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 156 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } 157 frame[0][7] = 1; 158 frame[1][6] = 1; 159 frame[1][7] = 1; 160 frame[2][5] = 1; 161 frame[2][7] = 1; 162 frame[3][4] = 1; 163 frame[3][7] = 1; 164 frame[4][3] = 1; 165 frame[4][4] = 1; 166 frame[4][5] = 1; 167 frame[4][6] = 1; 168 frame[4][7] = 1; 169 frame[4][8] = 1; 170 frame[5][7] = 1; 171 frame[6][7] = 1; 172 frame[7][7] = 1; 173} 174 175void five() 176{ 177 // { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, 178 // { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, 179 // { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, 180 // { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, 181 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 182 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 183 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 184 // { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 } 185 frame[0][3] = 1; 186 frame[0][4] = 1; 187 frame[0][5] = 1; 188 frame[0][6] = 1; 189 frame[0][7] = 1; 190 frame[1][3] = 1; 191 frame[2][3] = 1; 192 frame[3][3] = 1; 193 frame[3][4] = 1; 194 frame[3][5] = 1; 195 frame[3][6] = 1; 196 frame[3][7] = 1; 197 frame[4][7] = 1; 198 frame[5][7] = 1; 199 frame[6][7] = 1; 200 frame[7][3] = 1; 201 frame[7][4] = 1; 202 frame[7][5] = 1; 203 frame[7][6] = 1; 204 frame[7][7] = 1; 205} 206 207void six() 208{ 209 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 210 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 211 // { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, 212 // { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, 213 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 214 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 215 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 216 // { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 } 217 frame[0][4] = 1; 218 frame[0][5] = 1; 219 frame[0][6] = 1; 220 frame[0][7] = 1; 221 frame[1][3] = 1; 222 frame[1][8] = 1; 223 frame[2][3] = 1; 224 frame[3][3] = 1; 225 frame[3][4] = 1; 226 frame[3][5] = 1; 227 frame[3][6] = 1; 228 frame[3][7] = 1; 229 frame[4][3] = 1; 230 frame[4][8] = 1; 231 frame[5][3] = 1; 232 frame[5][8] = 1; 233 frame[6][3] = 1; 234 frame[6][8] = 1; 235 frame[7][4] = 1; 236 frame[7][5] = 1; 237 frame[7][6] = 1; 238 frame[7][7] = 1; 239} 240 241void seven() 242{ 243 // { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, 244 // { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 245 // { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 246 // { 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 }, 247 // { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, 248 // { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, 249 // { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, 250 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 251 frame[0][2] = 1; 252 frame[0][3] = 1; 253 frame[0][4] = 1; 254 frame[0][5] = 1; 255 frame[0][6] = 1; 256 frame[0][7] = 1; 257 frame[0][8] = 1; 258 frame[0][9] = 1; 259 frame[1][8] = 1; 260 frame[2][7] = 1; 261 frame[3][3] = 1; 262 frame[3][4] = 1; 263 frame[3][5] = 1; 264 frame[3][6] = 1; 265 frame[3][7] = 1; 266 frame[3][8] = 1; 267 frame[4][5] = 1; 268 frame[5][4] = 1; 269 frame[6][3] = 1; 270 frame[7][2] = 1; 271} 272 273void eight() 274{ 275 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 276 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 277 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 278 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 279 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 280 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 281 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 282 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 } 283 frame[0][4] = 1; 284 frame[0][5] = 1; 285 frame[0][6] = 1; 286 frame[0][7] = 1; 287 frame[1][3] = 1; 288 frame[1][8] = 1; 289 frame[2][3] = 1; 290 frame[2][8] = 1; 291 frame[3][4] = 1; 292 frame[3][5] = 1; 293 frame[3][6] = 1; 294 frame[3][7] = 1; 295 frame[4][3] = 1; 296 frame[4][8] = 1; 297 frame[5][3] = 1; 298 frame[5][8] = 1; 299 frame[6][3] = 1; 300 frame[6][8] = 1; 301 frame[7][4] = 1; 302 frame[7][5] = 1; 303 frame[7][6] = 1; 304 frame[7][7] = 1; 305} 306 307void nine() 308{ 309 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 310 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 311 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 312 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 313 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, 314 // { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, 315 // { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, 316 // { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 } 317 frame[0][4] = 1; 318 frame[0][5] = 1; 319 frame[0][6] = 1; 320 frame[0][7] = 1; 321 frame[1][3] = 1; 322 frame[1][8] = 1; 323 frame[2][3] = 1; 324 frame[2][8] = 1; 325 frame[3][3] = 1; 326 frame[3][8] = 1; 327 frame[4][4] = 1; 328 frame[4][5] = 1; 329 frame[4][6] = 1; 330 frame[4][7] = 1; 331 frame[5][8] = 1; 332 frame[6][8] = 1; 333 frame[6][3] = 1; 334 frame[7][4] = 1; 335 frame[7][5] = 1; 336 frame[7][6] = 1; 337 frame[7][7] = 1; 338} 339 340void zeroSmall(int shiftRow, int shiftCol) 341{ 342 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 343 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 344 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 345 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 346 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 347 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 348 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 349 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 350 frame[0 + shiftRow][1 + shiftCol] = 1; 351 frame[1 + shiftRow][0 + shiftCol] = 1; 352 frame[1 + shiftRow][2 + shiftCol] = 1; 353 frame[2 + shiftRow][0 + shiftCol] = 1; 354 frame[2 + shiftRow][2 + shiftCol] = 1; 355 frame[3 + shiftRow][0 + shiftCol] = 1; 356 frame[3 + shiftRow][2 + shiftCol] = 1; 357 frame[4 + shiftRow][1 + shiftCol] = 1; 358} 359 360void oneSmall(int shiftRow, int shiftCol) 361{ 362 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 363 // { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 364 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 365 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 366 // { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 367 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 368 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 369 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 370 frame[0 + shiftRow][1 + shiftCol] = 1; 371 frame[1 + shiftRow][0 + shiftCol] = 1; 372 frame[1 + shiftRow][1 + shiftCol] = 1; 373 frame[2 + shiftRow][1 + shiftCol] = 1; 374 frame[3 + shiftRow][1 + shiftCol] = 1; 375 frame[4 + shiftRow][1 + shiftCol] = 1; 376} 377 378void twoSmall(int shiftRow, int shiftCol) 379{ 380 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 381 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 382 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 383 // { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 384 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 385 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 386 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 387 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 388 frame[0 + shiftRow][0 + shiftCol] = 1; 389 frame[0 + shiftRow][1 + shiftCol] = 1; 390 frame[0 + shiftRow][2 + shiftCol] = 1; 391 frame[1 + shiftRow][2 + shiftCol] = 1; 392 frame[2 + shiftRow][0 + shiftCol] = 1; 393 frame[2 + shiftRow][1 + shiftCol] = 1; 394 frame[2 + shiftRow][2 + shiftCol] = 1; 395 frame[3 + shiftRow][0 + shiftCol] = 1; 396 frame[3 + shiftRow][0 + shiftCol] = 1; 397 frame[4 + shiftRow][0 + shiftCol] = 1; 398 frame[4 + shiftRow][1 + shiftCol] = 1; 399 frame[4 + shiftRow][2 + shiftCol] = 1; 400} 401 402void threeSmall(int shiftRow, int shiftCol) 403{ 404 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 405 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 406 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 407 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 408 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 409 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 410 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 411 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 412 frame[0 + shiftRow][0 + shiftCol] = 1; 413 frame[0 + shiftRow][1 + shiftCol] = 1; 414 frame[0 + shiftRow][2 + shiftCol] = 1; 415 frame[1 + shiftRow][2 + shiftCol] = 1; 416 frame[2 + shiftRow][0 + shiftCol] = 1; 417 frame[2 + shiftRow][1 + shiftCol] = 1; 418 frame[2 + shiftRow][2 + shiftCol] = 1; 419 frame[3 + shiftRow][2 + shiftCol] = 1; 420 frame[4 + shiftRow][0 + shiftCol] = 1; 421 frame[4 + shiftRow][1 + shiftCol] = 1; 422 frame[4 + shiftRow][2 + shiftCol] = 1; 423} 424 425void fourSmall(int shiftRow, int shiftCol) 426{ 427 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 428 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 429 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 430 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 431 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 432 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 433 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 434 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 435 frame[0 + shiftRow][0 + shiftCol] = 1; 436 frame[0 + shiftRow][2 + shiftCol] = 1; 437 frame[1 + shiftRow][0 + shiftCol] = 1; 438 frame[1 + shiftRow][2 + shiftCol] = 1; 439 frame[2 + shiftRow][0 + shiftCol] = 1; 440 frame[2 + shiftRow][1 + shiftCol] = 1; 441 frame[2 + shiftRow][2 + shiftCol] = 1; 442 frame[3 + shiftRow][2 + shiftCol] = 1; 443 frame[4 + shiftRow][2 + shiftCol] = 1; 444} 445 446void fiveSmall(int shiftRow, int shiftCol) 447{ 448 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 449 // { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 450 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 451 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 452 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 453 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 454 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 455 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 456 frame[0 + shiftRow][0 + shiftCol] = 1; 457 frame[0 + shiftRow][1 + shiftCol] = 1; 458 frame[0 + shiftRow][2 + shiftCol] = 1; 459 frame[1 + shiftRow][0 + shiftCol] = 1; 460 frame[2 + shiftRow][0 + shiftCol] = 1; 461 frame[2 + shiftRow][1 + shiftCol] = 1; 462 frame[2 + shiftRow][2 + shiftCol] = 1; 463 frame[3 + shiftRow][2 + shiftCol] = 1; 464 frame[4 + shiftRow][0 + shiftCol] = 1; 465 frame[4 + shiftRow][1 + shiftCol] = 1; 466 frame[4 + shiftRow][2 + shiftCol] = 1; 467} 468 469void sixSmall(int shiftRow, int shiftCol) 470{ 471 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 472 // { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 473 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 474 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 475 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 476 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 477 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 478 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 479 frame[0 + shiftRow][0 + shiftCol] = 1; 480 frame[0 + shiftRow][1 + shiftCol] = 1; 481 frame[0 + shiftRow][2 + shiftCol] = 1; 482 frame[1 + shiftRow][0 + shiftCol] = 1; 483 frame[2 + shiftRow][0 + shiftCol] = 1; 484 frame[2 + shiftRow][1 + shiftCol] = 1; 485 frame[2 + shiftRow][2 + shiftCol] = 1; 486 frame[3 + shiftRow][0 + shiftCol] = 1; 487 frame[3 + shiftRow][2 + shiftCol] = 1; 488 frame[4 + shiftRow][0 + shiftCol] = 1; 489 frame[4 + shiftRow][1 + shiftCol] = 1; 490 frame[4 + shiftRow][2 + shiftCol] = 1; 491} 492 493void sevenSmall(int shiftRow, int shiftCol) 494{ 495 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 496 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 497 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 498 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 499 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 500 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 501 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 502 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 503 frame[0 + shiftRow][0 + shiftCol] = 1; 504 frame[0 + shiftRow][1 + shiftCol] = 1; 505 frame[0 + shiftRow][2 + shiftCol] = 1; 506 frame[1 + shiftRow][2 + shiftCol] = 1; 507 frame[2 + shiftRow][2 + shiftCol] = 1; 508 frame[3 + shiftRow][2 + shiftCol] = 1; 509 frame[4 + shiftRow][2 + shiftCol] = 1; 510} 511 512void eightSmall(int shiftRow, int shiftCol) 513{ 514 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 515 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 516 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 517 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 518 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 519 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 520 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 521 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 522 frame[0 + shiftRow][0 + shiftCol] = 1; 523 frame[0 + shiftRow][1 + shiftCol] = 1; 524 frame[0 + shiftRow][2 + shiftCol] = 1; 525 frame[1 + shiftRow][0 + shiftCol] = 1; 526 frame[1 + shiftRow][2 + shiftCol] = 1; 527 frame[2 + shiftRow][0 + shiftCol] = 1; 528 frame[2 + shiftRow][1 + shiftCol] = 1; 529 frame[2 + shiftRow][2 + shiftCol] = 1; 530 frame[3 + shiftRow][0 + shiftCol] = 1; 531 frame[3 + shiftRow][2 + shiftCol] = 1; 532 frame[4 + shiftRow][0 + shiftCol] = 1; 533 frame[4 + shiftRow][1 + shiftCol] = 1; 534 frame[4 + shiftRow][2 + shiftCol] = 1; 535} 536 537void nineSmall(int shiftRow, int shiftCol) 538{ 539 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 540 // { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 541 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 542 // { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 543 // { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 544 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 545 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 546 // { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 547 frame[0 + shiftRow][0 + shiftCol] = 1; 548 frame[0 + shiftRow][1 + shiftCol] = 1; 549 frame[0 + shiftRow][2 + shiftCol] = 1; 550 frame[1 + shiftRow][0 + shiftCol] = 1; 551 frame[1 + shiftRow][2 + shiftCol] = 1; 552 frame[2 + shiftRow][0 + shiftCol] = 1; 553 frame[2 + shiftRow][1 + shiftCol] = 1; 554 frame[2 + shiftRow][2 + shiftCol] = 1; 555 frame[3 + shiftRow][2 + shiftCol] = 1; 556 frame[4 + shiftRow][0 + shiftCol] = 1; 557 frame[4 + shiftRow][1 + shiftCol] = 1; 558 frame[4 + shiftRow][2 + shiftCol] = 1; 559}
Downloadable files
real_time_clock
main program
real_time_clock.ino
LedMatrixNumbers
Numbers library for LED Matrix of Arduino Uno R4
LedMatrixNumbers.h
Comments
Only logged in users can leave comments