├── .DS_Store ├── ASCII_converter.ino ├── AdvancedLED.ino ├── Binary_counter.ino ├── DaisyChain ├── daisyChainedRegs.ino ├── readme └── types.h ├── HCSR04.ino ├── LEDGrid ├── LEDGrid.ino └── aPixelData.ino ├── LEDStrip.ino ├── PongLEDBaseline.ino ├── PongLEDsNewest.ino ├── ShiftRegister ├── ShiftRegisterTutorial.ino └── types.h ├── lcd.ino ├── potentiometer_switch.ino └── sevenSeg ├── ControlPanelDriver.ino ├── a7segDisplay.ino ├── readme ├── rotaryEncoder.ino └── typedefs.h /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendog993/Youtube_arduino/303118006a7d2a78f6bf209c22b16b93821bbde5/.DS_Store -------------------------------------------------------------------------------- /ASCII_converter.ino: -------------------------------------------------------------------------------- 1 | void setup() { 2 | pinMode(3, OUTPUT); 3 | pinMode(4, OUTPUT); 4 | pinMode(5, OUTPUT); 5 | pinMode(6, OUTPUT); 6 | pinMode(7, OUTPUT); 7 | pinMode(8, OUTPUT); 8 | pinMode(9, OUTPUT); 9 | Serial.begin(9600); 10 | } 11 | 12 | void blank_leds() { 13 | for (int i=3; i<10; i++) { 14 | digitalWrite(i, LOW); 15 | } 16 | delay(5); 17 | } 18 | 19 | 20 | void decimal_to_binary_write(int decimal_number) { 21 | int bin_array[7] = {0,0,0,0,0,0,0} ; 22 | for(int i = 0; decimal_number > 0; i++) { 23 | bin_array[i] = decimal_number % 2; 24 | decimal_number = decimal_number/2; 25 | } 26 | // Writes the respective LED to 0 or 1, the binary state. 27 | digitalWrite(3, bin_array[6]); 28 | digitalWrite(4, bin_array[5]); 29 | digitalWrite(5, bin_array[4]); 30 | digitalWrite(6, bin_array[3]); 31 | digitalWrite(7, bin_array[2]); 32 | digitalWrite(8, bin_array[1]); 33 | digitalWrite(9, bin_array[0]); 34 | } 35 | 36 | const char * message = "This is going to a test, how well does these LEDs blink. " ; 37 | void loop() { 38 | // For every character in the string, print to serial monitor 39 | for (int i; i 2 | #define LED_PIN 2 3 | #define NUM_LEDS 128 4 | 5 | CRGB leds[NUM_LEDS]; 6 | 7 | void setup() { 8 | FastLED.addLeds(leds, NUM_LEDS); 9 | FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); 10 | FastLED.clear(); 11 | FastLED.show(); 12 | Serial.begin(9600); 13 | } 14 | 15 | void rainbow_right_to_left() { 16 | // RED 17 | 18 | for (int i=0; i<12; i++){ 19 | leds[i] = CRGB(255, 7*i, 0); 20 | delay(20); 21 | FastLED.setBrightness(50+i); 22 | FastLED.show(); 23 | } 24 | 25 | // Orange 26 | for (int i=12; i<24; i++){ 27 | leds[i] = CRGB(255, 77+7*i, 0); 28 | delay(20); 29 | FastLED.setBrightness(50+i); 30 | FastLED.show(); 31 | } 32 | 33 | // YELLOW 34 | for (int i=24; i<36; i++){ 35 | leds[i] = CRGB(255-(i-24)*23, 255, 0); 36 | delay(20); 37 | FastLED.setBrightness(50+i); 38 | FastLED.show(); 39 | } 40 | 41 | // GREEN 42 | for (int i=36; i<48; i++){ 43 | leds[i] = CRGB(2, 255-(i-36)*23, (i-36)*23); 44 | delay(20); 45 | FastLED.setBrightness(50+i); 46 | FastLED.show(); 47 | } 48 | 49 | // BLUE 50 | for (int i=48; i<60; i++){ 51 | leds[i] = CRGB((i-48)*23, 0, 255); 52 | delay(20); 53 | FastLED.setBrightness(50+i); 54 | FastLED.show(); 55 | } 56 | // PURPLE 57 | 58 | 59 | FastLED.clear(); 60 | delay(600); 61 | FastLED.show(); 62 | 63 | } 64 | 65 | void flashing_changing_color() { 66 | for (int i=0; i30; i--) { 77 | FastLED.setBrightness(i); 78 | delay(5); 79 | FastLED.show(); 80 | } 81 | FastLED.clear(); 82 | 83 | for (int i=0; i30; i--) { 94 | FastLED.setBrightness(i); 95 | delay(5); 96 | FastLED.show(); 97 | } 98 | FastLED.clear(); 99 | 100 | for (int i=0; i30; i--) { 111 | FastLED.setBrightness(i); 112 | delay(5); 113 | FastLED.show(); 114 | } 115 | FastLED.clear(); 116 | 117 | for (int i=0; i30; i--) { 128 | FastLED.setBrightness(i); 129 | delay(5); 130 | FastLED.show(); 131 | } 132 | FastLED.clear(); 133 | 134 | } 135 | 136 | void start_from_middle() { 137 | for (int i=0; i R 232 | for (int i=0; i<17; i++) { 233 | leds[row1[i]] = CRGB(255,0,0); 234 | FastLED.show(); 235 | delay(5); 236 | } 237 | // Bottom Row 238 | for (int i=17; i>0; i--) { 239 | leds[row7[i]] = CRGB(0,0,255); 240 | FastLED.show(); 241 | delay(5); 242 | } 243 | 244 | // 2nd row from top: L->R 245 | for (int i=0; i<18; i++) { 246 | leds[row2[i]] = CRGB(255,167,0); 247 | FastLED.show(); 248 | delay(5); 249 | } 250 | // 2nd row from bottom; R->L 251 | for (int i=18; i>0; i--) { 252 | leds[row6[i]] = CRGB(255,0,255); 253 | FastLED.show(); 254 | delay(5); 255 | } 256 | 257 | // 3rd row from top L->R 258 | for (int i=0; i<19; i++) { 259 | leds[row3[i]] = CRGB(0,255,0); 260 | FastLED.show(); 261 | delay(5); 262 | } 263 | // 3rd row from bottom r -> L 264 | for (int i=19; i>0; i--) { 265 | leds[row5[i]] = CRGB(0,160,160); 266 | FastLED.show(); 267 | delay(5); 268 | } 269 | // Center Row 270 | for (int i=0; i<10; i++) { 271 | leds[row4[10+i]] = CRGB(255,255,255); 272 | leds[row4[10-i]] = CRGB(255,255,255); 273 | FastLED.show(); 274 | delay(5); 275 | } 276 | delay(400); 277 | FastLED.clear(); 278 | FastLED.show(); 279 | 280 | } 281 | 282 | int lights1[30] = {5,7,18,21,32,22,23,29,28 , 46,50,51,57,56,58,65,63,73,72,80,81, 283 | 88,92,93,99,98,102,101,94,84}; 284 | int lights2[10] = {49,59,58,65,72,74,78,79,85,84}; 285 | int lights3[46] = {5,8,9,15,14,25,28,29,23,22,18,39,42,43,37,36,32, 56,57,51,50, 286 | 46,49,60,64,65,58,51,71,70, 74,77,88,87,86,94,95, 119, 287 | 116,105,106,100,108,109,112,123}; 288 | int lights4[39] = {5,8,9,15,14,16,23,21,31,30,38,39, 35,45,44,52,53, 67,66,58, 289 | 59,49,60,63,73,72,80,81,105,102,91,92,86,94,95,98,108,107,100}; 290 | 291 | 292 | void GrandFinale() { 293 | for (int i=0; i<30; i++) { 294 | leds[lights1[i]] = CRGB(255,255,255); 295 | FastLED.show(); 296 | delay(100); 297 | } 298 | FastLED.clear(); 299 | FastLED.show(); 300 | 301 | for (int i=0; i<10; i++) { 302 | leds[lights2[i]] = CRGB(255,255,255); 303 | FastLED.show(); 304 | delay(100); 305 | } 306 | FastLED.clear(); 307 | FastLED.show(); 308 | for (int i=0; i<46; i++) { 309 | leds[lights3[i]] = CRGB(255,255,255); 310 | FastLED.show(); 311 | delay(100); 312 | } 313 | FastLED.clear(); 314 | FastLED.show(); 315 | for (int i=0; i<39; i++) { 316 | leds[lights4[i]] = CRGB(255,255,255); 317 | FastLED.show(); 318 | delay(100); 319 | } 320 | FastLED.clear(); 321 | FastLED.show(); 322 | delay(2000); 323 | } 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | void loop() { 345 | PongMovingRainbow(); 346 | } 347 | -------------------------------------------------------------------------------- /Binary_counter.ino: -------------------------------------------------------------------------------- 1 | // Pin numbers 2 | const int led1 = 2; 3 | const int led2 = 3; 4 | const int led4 = 4; 5 | const int led8 = 5; 6 | const int led16 = 6; 7 | const int led32 = 7; 8 | const int led64 = 8; 9 | const int led128 = 9; 10 | 11 | // Rotary encoder 12 | const int inRot1 = 10; 13 | const int inRot2 = 11; 14 | 15 | // Variables 16 | int counter = 0; 17 | int aState, aLastState; 18 | 19 | void decimal_to_binary(int input) { 20 | // Construct a binary array and update its contents with the result of loop. 21 | int bin_array[8] = {0,0,0,0,0,0,0,0}; 22 | // Set up a for loop to iterate input 23 | for (int i = 0; input > 0; i++) { 24 | bin_array[i] = input%2 ; // stores the answer backwards 25 | input = input/2; 26 | } 27 | // Write LED based on array 28 | digitalWrite(led1, bin_array[0]); 29 | digitalWrite(led2, bin_array[1]); 30 | digitalWrite(led4, bin_array[2]); 31 | digitalWrite(led8, bin_array[3]); 32 | digitalWrite(led16, bin_array[4]); 33 | digitalWrite(led32, bin_array[5]); 34 | digitalWrite(led64, bin_array[6]); 35 | digitalWrite(led128, bin_array[7]); 36 | 37 | 38 | } 39 | 40 | 41 | void setup() { 42 | pinMode(led1, OUTPUT); 43 | pinMode(led2, OUTPUT); 44 | pinMode(led4, OUTPUT); 45 | pinMode(led8, OUTPUT); 46 | pinMode(led16, OUTPUT); 47 | pinMode(led32, OUTPUT); 48 | pinMode(led64, OUTPUT); 49 | pinMode(led128, OUTPUT); 50 | pinMode(inRot1, INPUT); 51 | pinMode(inRot2, INPUT); 52 | Serial.begin(9600); 53 | 54 | 55 | } 56 | 57 | void loop() { 58 | // generate integer from knob, 59 | int state1 = digitalRead(inRot1); 60 | int state2 = digitalRead(inRot2); 61 | 62 | 63 | // if state 1 changes, increment counter. 64 | // the knob changes if state1 does not equal laststate 65 | if (state1!= aLastState) { 66 | // Clockwise 67 | if (state2 != state1) { 68 | counter ++; 69 | if (counter > 255) counter = 0; 70 | } 71 | else counter--; 72 | if (counter < 0) counter = 255; 73 | // Decrement is ccw 74 | } 75 | decimal_to_binary(counter); 76 | 77 | Serial.println(counter); 78 | aLastState = state1; 79 | } 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /DaisyChain/daisyChainedRegs.ino: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | /* 4 | * init function 5 | * writeByte 6 | */ 7 | 8 | void SR595N_init( Shift_Register_595N * const sr ) 9 | { 10 | pinMode( sr->SER, OUTPUT); 11 | pinMode( sr->RCLK, OUTPUT); 12 | pinMode( sr->SCLK, OUTPUT); 13 | } 14 | 15 | /* Byte value, and write LSB to data pin , pulse SCLK, shift value by >> 1, repeat 8x. Pulse OUT REG 16 | * 0b11011011 17 | */ 18 | void SR595N_writeVal ( const Shift_Register_595N * const sr , uint16_t val ) 19 | { 20 | uint8_t counter; 21 | byte shiftVal; 22 | 23 | for ( counter = 0; counter < NUM_BITS_IN_2BY ; counter++ ) 24 | { 25 | shiftVal = ( val & 0x01 ); 26 | digitalWrite ( sr->SER, shiftVal ); 27 | digitalWrite ( sr->SCLK, HIGH); 28 | digitalWrite ( sr->SCLK, LOW); 29 | val = val >> 1; 30 | } 31 | digitalWrite ( sr->RCLK, HIGH); 32 | digitalWrite ( sr->RCLK, LOW); 33 | } 34 | 35 | Shift_Register_595N sr1 = 36 | { 37 | .SER = 4, 38 | .RCLK = 5, 39 | .SCLK = 6 40 | }; 41 | 42 | void setup() 43 | { 44 | SR595N_init ( &sr1 ); 45 | Serial.begin(115200); 46 | } 47 | 48 | 49 | void shiftPattern( const Shift_Register_595N * const sr ) 50 | { 51 | uint16_t val = 0x01; 52 | uint8_t counter; 53 | 54 | for ( counter = 0; counter < NUM_BITS_IN_2BY; counter++ ) 55 | { 56 | SR595N_writeVal (sr, val ); 57 | val = val << 1; 58 | delay(100); 59 | } 60 | 61 | val = 0x8000; 62 | for ( counter = 0; counter < NUM_BITS_IN_2BY; counter++ ) 63 | { 64 | SR595N_writeVal (sr, val ); 65 | val = val >> 1; 66 | delay(100); 67 | } 68 | 69 | 70 | 71 | } 72 | void loop() 73 | { 74 | shiftPattern (&sr1); 75 | } 76 | -------------------------------------------------------------------------------- /DaisyChain/readme: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DaisyChain/types.h: -------------------------------------------------------------------------------- 1 | #define NUM_BITS_IN_BYTE 8 2 | #define NUM_BITS_IN_2BY 16 3 | 4 | typedef struct Shift_Register_t_595N_t 5 | { 6 | byte SER; 7 | byte RCLK; 8 | byte SCLK; 9 | } Shift_Register_595N; 10 | -------------------------------------------------------------------------------- /HCSR04.ino: -------------------------------------------------------------------------------- 1 | const int trigPin = 9; 2 | const int echoPin = 10; 3 | 4 | float duration; 5 | float distance; 6 | 7 | void setup(){ 8 | pinMode(trigPin, OUTPUT); 9 | pinMode(echoPin, INPUT); 10 | Serial.begin(9600); 11 | 12 | } 13 | 14 | 15 | void loop() { 16 | // Clear the trig pin 17 | digitalWrite(trigPin, LOW); 18 | delayMicroseconds(2); 19 | 20 | 21 | // Send out a soundwave for 10 microseconds, then turn back off 22 | digitalWrite(trigPin, HIGH); 23 | delayMicroseconds(10); 24 | digitalWrite(trigPin, LOW); 25 | 26 | // Read the duration of the soundwave 27 | duration = pulseIn(echoPin, HIGH); 28 | 29 | 30 | // Convert time to distance, and display on monitor 31 | distance = duration * 0.034/2; 32 | 33 | Serial.println(distance); 34 | 35 | 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /LEDGrid/LEDGrid.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Project goals: 3 | * 1. Write images using large format and calculate bytes/data used 4 | * 2. Write compression algorithm and calculate bytes saved 5 | * 3. Write decompression algorithm to rewrite original image 6 | */ 7 | 8 | 9 | /* 10 | * Progression 11 | * 1. Get structure format 12 | * 2. Draw RGB only (255) images 13 | * 3. Compress and decompress properly. 14 | * 4. Calculate bytes saved 15 | */ 16 | 17 | 18 | /*Compression format 19 | * 6 rows of 10 values 20 | * per 21 | * per row: [4 bit number (max is 10) 4 bit map to color: RED BLUE GREEN or OFF] 22 | * 23 | */ 24 | 25 | 26 | #include 27 | #include 28 | 29 | #define LED_PIN 2 30 | #define NUM_LEDS 60 31 | CRGB leds[NUM_LEDS]; 32 | #define RESOLUTION_X 10 33 | #define RESOLUTION_Y 6 34 | 35 | // Image format: should simply be an array of bytes. 36 | // 60 pixels, 3 RGB values, 180 bytes total. 37 | typedef byte image[180]; 38 | 39 | // Single row format test. 40 | 41 | image pic1 = {233,243,101, 23,10,56, 43,65,700, 63,12,90, 12,12,12, 44,44,44, 101,206, 43, 12,90, 72, 12,12,12,51,55,90}; 42 | image * picptr = &pic1; 43 | 44 | 45 | byte GetLengthOfImage (image imgPtr ) { 46 | 47 | return sizeof(imgPtr) / sizeof(imgPtr[0]); 48 | 49 | } 50 | 51 | 52 | int32_t imgCheckFormatValid(image imagePointer ) 53 | { 54 | 55 | int32_t s32_returnval = 1; 56 | byte lengthOfArray = GetLengthOfImage(imagePointer); 57 | Serial.println(lengthOfArray); 58 | if (imagePointer == NULL || 59 | lengthOfArray > 180 60 | ) 61 | { 62 | s32_returnval = 0; 63 | return s32_returnval; 64 | } 65 | 66 | // Iterate through and check if any value is greater than 255. If yes, exit routine and return error. 67 | for (int i = 0; i < lengthOfArray ; i++) { 68 | if ( imagePointer[i] > 255 ) { 69 | s32_returnval = 0; 70 | return s32_returnval; 71 | } 72 | } 73 | 74 | return s32_returnval; 75 | } 76 | 77 | 78 | byte pixel_data[60] = 79 | { 80 | 0,1,2,3,4,5,6,7,8,9, 81 | 19,18,17,16,15,14,13,12,11,10, 82 | 20,21,22,23,24,25,26,27,28,29, 83 | 39,38,37,36,35,34,33,32,31,30, 84 | 40,41,42,43,44,45,46,47,48,49, 85 | 59,58,57,56,55,54,53,52,51,50 86 | }; 87 | 88 | 89 | typedef struct COMPRESSED_OBJECT { 90 | 91 | 92 | } COMPRESSED_OBJECT; 93 | 94 | uint8_t pixel_buffer; 95 | 96 | int32_t compress_object() { 97 | int32_t s32_returnval = 1; 98 | return s32_returnval; 99 | } 100 | 101 | int32_t decompress_object() { 102 | int32_t s32_returnval = 1; 103 | return s32_returnval; 104 | } 105 | 106 | int32_t decompress_single_row() { 107 | int32_t s32_returnval = 1; 108 | return s32_returnval; 109 | } 110 | 111 | void GetPtrAndIncBufferPtr() { 112 | 113 | 114 | } 115 | 116 | 117 | int32_t WriteImage ( image imgPtr ) 118 | { 119 | int32_t s32_returnval; 120 | s32_returnval &= imgCheckFormatValid(imgPtr); 121 | 122 | } 123 | 124 | void setup() { 125 | FastLED.addLeds(leds, NUM_LEDS); 126 | FastLED.setMaxPowerInVoltsAndMilliamps(5, 300); 127 | FastLED.clear(); 128 | FastLED.show(); 129 | Serial.begin(9600); 130 | } 131 | 132 | 133 | void loop() { 134 | 135 | int32_t val = imgCheckFormatValid(pic1); 136 | } 137 | -------------------------------------------------------------------------------- /LEDGrid/aPixelData.ino: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendog993/Youtube_arduino/303118006a7d2a78f6bf209c22b16b93821bbde5/LEDGrid/aPixelData.ino -------------------------------------------------------------------------------- /LEDStrip.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #define LED_PIN 2 3 | #define NUM_LEDS 60 4 | 5 | CRGB leds[NUM_LEDS]; 6 | 7 | 8 | void setup() { 9 | FastLED.addLeds(leds, NUM_LEDS); 10 | FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); 11 | FastLED.clear(); 12 | FastLED.show(); 13 | 14 | } 15 | 16 | void loop() { 17 | // Turn lights from green to blue from left to right R G B 18 | for (int i=0; i0; i--){ 26 | leds[i] = CRGB(4*i,0 , 255-4*i); 27 | FastLED.setBrightness(100-i); 28 | FastLED.show(); 29 | delay(50); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /PongLEDBaseline.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define LED_PIN 2 4 | #define NUM_LEDS 128 5 | #define IR_PIN 5 6 | CRGB leds[NUM_LEDS]; 7 | 8 | // GLOBALS 9 | // LED assignments of each digit. 10 | int first_digit[12] = {7, 8, 9, 10, 11, 14,15,16,17,18, 22, 24}; 11 | int second_digit[12] = {35,36,37,38,39,42,43,44,45,46, 50, 52}; 12 | int third_digit[12] = {77, 78, 79, 80, 81, 84, 85, 86, 87, 88, 92, 94}; 13 | int fourth_digit[12] = {105,106,107,108,109, 112,113,114,115,116, 120, 122}; 14 | int background[78] = {0,1,2,3,4,5,6,13,19,29,21,22,25,26,27,28,30,31,32,33,34, 40,41,47,48,49,51,53, 15 | 54,55,56,57,58,69,60,61,62,63,65,67,68,69, 70,71,72,73,74,75,76, 82,83, 89, 90, 16 | 91,93,95,96,97,98,99,100,101,102,103,104,111,117,118,119,121,123,124,125,126,127}; 17 | 18 | int row1[17] = {6,19,20,33,34,47,48,61,62,75,76,89,90,103,104,117,118}; 19 | int row2[18] = {5,7,18,21,32,35,46,49,60,63,74,77,88,91,102,105,116,119}; 20 | int row3[19] = {4,8,17,22,31,36,45,50,59,64,73,78,87,92,101,106,115,120,127}; 21 | int row4[20] = {0,3,9,16,23,30,37,44,51,58,65,72,79,86,93,100,107,114,121,126}; 22 | int row5[19] = {2,10,15,24,29,38,43,52,57,66,71,80,85,94,99,108,113,122,125}; 23 | int row6[18] = {1,11,14,25,28,39,42,53,56,67,70,81,84,95,98,109,112,123}; 24 | int row7[17] = {12,13,26,27,40,41,54,55,68,69,82,83,96,97,110,111,124}; 25 | 26 | int perimeter[] = {0,2,1,12,13,26,27,40,41,54,55,68,69,82,83,96,97,110,111,124,123,125,126,127,119,118,117, 27 | 104,103,90,89,76,75,62,61,48,47,34,33,20,19,6,5,4}; 28 | 29 | // END GLOBALS 30 | 31 | // LED Order for writing certain digits. 32 | 33 | void write_digit_one(int number) { 34 | switch (number) { 35 | case 1: 36 | leds[14] = CRGB(255,0,0); 37 | leds[24] = CRGB(255,0,0); 38 | leds[16] = CRGB(255,255,255); 39 | leds[22] = CRGB(255,255,255); 40 | leds[18] = CRGB(255,255,255); 41 | FastLED.show(); 42 | break; 43 | case 2: 44 | leds[7] = CRGB(255,255,255); 45 | leds[18] = CRGB(255,255,255); 46 | leds[22] = CRGB(255,255,255); 47 | leds[16] = CRGB(255,255,255); 48 | leds[9] = CRGB(255,255,255); 49 | leds[10] = CRGB(255,255,255); 50 | leds[11] = CRGB(255,255,255); 51 | leds[14] = CRGB(255,255,255); 52 | FastLED.show(); 53 | break; 54 | case 3: 55 | leds[7] = CRGB(255,255,255); 56 | leds[18] = CRGB(255,255,255); 57 | leds[22] = CRGB(255,255,255); 58 | leds[16] = CRGB(255,255,255); 59 | leds[9] = CRGB(255,255,255); 60 | leds[24] = CRGB(255,255,255); 61 | leds[14] = CRGB(255,255,255); 62 | leds[11] = CRGB(255,255,255); 63 | FastLED.show(); 64 | break; 65 | case 4: 66 | leds[7] = CRGB(255,255,255); 67 | leds[8] = CRGB(255,255,255); 68 | leds[9] = CRGB(255,255,255); 69 | leds[16] = CRGB(255,255,255); 70 | leds[22] = CRGB(255,255,255); 71 | leds[15] = CRGB(255,255,255); 72 | leds[11] = CRGB(255,255,255); 73 | FastLED.show(); 74 | break; 75 | case 5: 76 | leds[7] = CRGB(255,255,255); 77 | leds[18] = CRGB(255,255,255); 78 | leds[8] = CRGB(255,255,255); 79 | leds[9] = CRGB(255,255,255); 80 | leds[16] = CRGB(255,255,255); 81 | leds[24] = CRGB(255,255,255); 82 | leds[11] = CRGB(255,255,255); 83 | leds[14] = CRGB(255,255,255); 84 | FastLED.show(); 85 | break; 86 | case 6: 87 | leds[18] = CRGB(255,255,255); 88 | leds[17] = CRGB(255,255,255); 89 | leds[9] = CRGB(255,255,255); 90 | leds[16] = CRGB(255,255,255); 91 | leds[10] = CRGB(255,255,255); 92 | leds[24] = CRGB(255,255,255); 93 | leds[11] = CRGB(255,255,255); 94 | leds[14] = CRGB(255,255,255); 95 | FastLED.show(); 96 | break; 97 | case 7: 98 | leds[7] = CRGB(255,255,255); 99 | leds[18] = CRGB(255,255,255); 100 | leds[22] = CRGB(255,255,255); 101 | leds[16] = CRGB(255,255,255); 102 | leds[15] = CRGB(255,255,255); 103 | leds[11] = CRGB(255,255,255); 104 | FastLED.show(); 105 | break; 106 | case 8: 107 | leds[7] = CRGB(255,255,255); 108 | leds[18] = CRGB(255,255,255); 109 | leds[8] = CRGB(255,255,255); 110 | leds[22] = CRGB(255,255,255); 111 | leds[9] = CRGB(255,255,255); 112 | leds[16] = CRGB(255,255,255); 113 | leds[10] = CRGB(255,255,255); 114 | leds[24] = CRGB(255,255,255); 115 | leds[11] = CRGB(255,255,255); 116 | leds[14] = CRGB(255,255,255); 117 | FastLED.show(); 118 | break; 119 | case 9: 120 | leds[7] = CRGB(255,255,255); 121 | leds[18] = CRGB(255,255,255); 122 | leds[8] = CRGB(255,255,255); 123 | leds[22] = CRGB(255,255,255); 124 | leds[9] = CRGB(255,255,255); 125 | leds[16] = CRGB(255,255,255); 126 | leds[15] = CRGB(255,255,255); 127 | leds[11] = CRGB(255,255,255); 128 | FastLED.show(); 129 | break; 130 | case 0: 131 | leds[7] = CRGB(255,255,255); 132 | leds[18] = CRGB(255,255,255); 133 | leds[8] = CRGB(255,255,255); 134 | leds[22] = CRGB(255,255,255); 135 | leds[10] = CRGB(255,255,255); 136 | leds[24] = CRGB(255,255,255); 137 | leds[11] = CRGB(255,255,255); 138 | leds[14] = CRGB(255,255,255); 139 | FastLED.show(); 140 | break; 141 | 142 | 143 | 144 | default: 145 | break; 146 | }; 147 | } 148 | void write_digit_two(int number) { 149 | switch (number) { 150 | case 1: 151 | leds[46] = CRGB(255,255,255); 152 | leds[50] = CRGB(255,255,255); 153 | leds[44] = CRGB(255,255,255); 154 | leds[52] = CRGB(255,255,255); 155 | leds[42] = CRGB(255,255,255); 156 | FastLED.show(); 157 | break; 158 | case 2: 159 | leds[35] = CRGB(255,255,255); 160 | leds[46] = CRGB(255,255,255); 161 | leds[50] = CRGB(255,255,255); 162 | leds[44] = CRGB(255,255,255); 163 | leds[37] = CRGB(255,255,255); 164 | leds[38] = CRGB(255,255,255); 165 | leds[39] = CRGB(255,255,255); 166 | leds[42] = CRGB(255,255,255); 167 | FastLED.show(); 168 | break; 169 | case 3: 170 | leds[35] = CRGB(255,255,255); 171 | leds[46] = CRGB(255,255,255); 172 | leds[50] = CRGB(255,255,255); 173 | leds[44] = CRGB(255,255,255); 174 | leds[37] = CRGB(255,255,255); 175 | leds[52] = CRGB(255,255,255); 176 | leds[39] = CRGB(255,255,255); 177 | leds[42] = CRGB(255,255,255); 178 | FastLED.show(); 179 | break; 180 | case 4: 181 | leds[35] = CRGB(255,255,255); 182 | leds[36] = CRGB(255,255,255); 183 | leds[37] = CRGB(255,255,255); 184 | leds[44] = CRGB(255,255,255); 185 | leds[50] = CRGB(255,255,255); 186 | leds[43] = CRGB(255,255,255); 187 | leds[39] = CRGB(255,255,255); 188 | FastLED.show(); 189 | break; 190 | case 5: 191 | leds[46] = CRGB(255,255,255); 192 | leds[35] = CRGB(255,255,255); 193 | leds[36] = CRGB(255,255,255); 194 | leds[37] = CRGB(255,255,255); 195 | leds[44] = CRGB(255,255,255); 196 | leds[52] = CRGB(255,255,255); 197 | leds[42] = CRGB(255,255,255); 198 | leds[39] = CRGB(255,255,255); 199 | FastLED.show(); 200 | break; 201 | case 6: 202 | leds[46] = CRGB(255,255,255); 203 | leds[45] = CRGB(255,255,255); 204 | leds[37] = CRGB(255,255,255); 205 | leds[38] = CRGB(255,255,255); 206 | leds[39] = CRGB(255,255,255); 207 | leds[42] = CRGB(255,255,255); 208 | leds[52] = CRGB(255,255,255); 209 | leds[44] = CRGB(255,255,255); 210 | FastLED.show(); 211 | break; 212 | case 7: 213 | leds[35] = CRGB(255,255,255); 214 | leds[46] = CRGB(255,255,255); 215 | leds[50] = CRGB(255,255,255); 216 | leds[44] = CRGB(255,255,255); 217 | leds[43] = CRGB(255,255,255); 218 | leds[39] = CRGB(255,255,255); 219 | FastLED.show(); 220 | break; 221 | case 8: 222 | leds[35] = CRGB(255,255,255); 223 | leds[46] = CRGB(255,255,255); 224 | leds[36] = CRGB(255,255,255); 225 | leds[50] = CRGB(255,255,255); 226 | leds[37] = CRGB(255,255,255); 227 | leds[44] = CRGB(255,255,255); 228 | leds[38] = CRGB(255,255,255); 229 | leds[52] = CRGB(255,255,255); 230 | leds[39] = CRGB(255,255,255); 231 | leds[42] = CRGB(255,255,255); 232 | FastLED.show(); 233 | break; 234 | case 9: 235 | leds[35] = CRGB(255,255,255); 236 | leds[46] = CRGB(255,255,255); 237 | leds[50] = CRGB(255,255,255); 238 | leds[44] = CRGB(255,255,255); 239 | leds[43] = CRGB(255,255,255); 240 | leds[39] = CRGB(255,255,255); 241 | leds[36] = CRGB(255,255,255); 242 | leds[37] = CRGB(255,255,255); 243 | FastLED.show(); 244 | break; 245 | case 0: 246 | leds[35] = CRGB(255,255,255); 247 | leds[46] = CRGB(255,255,255); 248 | leds[36] = CRGB(255,255,255); 249 | leds[50] = CRGB(255,255,255); 250 | leds[38] = CRGB(255,255,255); 251 | leds[52] = CRGB(255,255,255); 252 | leds[39] = CRGB(255,255,255); 253 | leds[42] = CRGB(255,255,255); 254 | FastLED.show(); 255 | break; 256 | default: 257 | break; 258 | }; 259 | } 260 | void write_digit_three(int number) { 261 | switch (number) { 262 | case 1: 263 | leds[88] = CRGB(255,255,255); 264 | leds[92] = CRGB(255,255,255); 265 | leds[86] = CRGB(255,255,255); 266 | leds[94] = CRGB(255,255,255); 267 | leds[84] = CRGB(255,255,255); 268 | FastLED.show(); 269 | break; 270 | case 2: 271 | leds[77] = CRGB(255,255,255); 272 | leds[88] = CRGB(255,255,255); 273 | leds[92] = CRGB(255,255,255); 274 | leds[86] = CRGB(255,255,255); 275 | leds[79] = CRGB(255,255,255); 276 | leds[80] = CRGB(255,255,255); 277 | leds[81] = CRGB(255,255,255); 278 | leds[84] = CRGB(255,255,255); 279 | FastLED.show(); 280 | break; 281 | case 3: 282 | leds[77] = CRGB(255,255,255); 283 | leds[88] = CRGB(255,255,255); 284 | leds[92] = CRGB(255,255,255); 285 | leds[86] = CRGB(255,255,255); 286 | leds[79] = CRGB(255,255,255); 287 | leds[94] = CRGB(255,255,255); 288 | leds[84] = CRGB(255,255,255); 289 | leds[81] = CRGB(255,255,255); 290 | FastLED.show(); 291 | break; 292 | case 4: 293 | leds[77] = CRGB(255,255,255); 294 | leds[78] = CRGB(255,255,255); 295 | leds[79] = CRGB(255,255,255); 296 | leds[86] = CRGB(255,255,255); 297 | leds[92] = CRGB(255,255,255); 298 | leds[85] = CRGB(255,255,255); 299 | leds[81] = CRGB(255,255,255); 300 | FastLED.show(); 301 | break; 302 | case 5: 303 | leds[88] = CRGB(255,255,255); 304 | leds[77] = CRGB(255,255,255); 305 | leds[78] = CRGB(255,255,255); 306 | leds[79] = CRGB(255,255,255); 307 | leds[86] = CRGB(255,255,255); 308 | leds[94] = CRGB(255,255,255); 309 | leds[84] = CRGB(255,255,255); 310 | leds[81] = CRGB(255,255,255); 311 | FastLED.show(); 312 | break; 313 | case 6: 314 | leds[88] = CRGB(255,255,255); 315 | leds[87] = CRGB(255,255,255); 316 | leds[79] = CRGB(255,255,255); 317 | leds[80] = CRGB(255,255,255); 318 | leds[81] = CRGB(255,255,255); 319 | leds[84] = CRGB(255,255,255); 320 | leds[94] = CRGB(255,255,255); 321 | leds[86] = CRGB(255,255,255); 322 | FastLED.show(); 323 | break; 324 | case 7: 325 | leds[77] = CRGB(255,255,255); 326 | leds[88] = CRGB(255,255,255); 327 | leds[92] = CRGB(255,255,255); 328 | leds[86] = CRGB(255,255,255); 329 | leds[85] = CRGB(255,255,255); 330 | leds[81] = CRGB(255,255,255); 331 | FastLED.show(); 332 | break; 333 | case 8: 334 | leds[77] = CRGB(255,255,255); 335 | leds[78] = CRGB(255,255,255); 336 | leds[88] = CRGB(255,255,255); 337 | leds[92] = CRGB(255,255,255); 338 | leds[79] = CRGB(255,255,255); 339 | leds[86] = CRGB(255,255,255); 340 | leds[80] = CRGB(255,255,255); 341 | leds[94] = CRGB(255,255,255); 342 | leds[84] = CRGB(255,255,255); 343 | leds[81] = CRGB(255,255,255); 344 | FastLED.show(); 345 | break; 346 | case 9: 347 | leds[77] = CRGB(255,255,255); 348 | leds[88] = CRGB(255,255,255); 349 | leds[92] = CRGB(255,255,255); 350 | leds[78] = CRGB(255,255,255); 351 | leds[79] = CRGB(255,255,255); 352 | leds[86] = CRGB(255,255,255); 353 | leds[85] = CRGB(255,255,255); 354 | leds[81] = CRGB(255,255,255); 355 | FastLED.show(); 356 | break; 357 | case 0: 358 | leds[77] = CRGB(255,255,255); 359 | leds[88] = CRGB(255,255,255); 360 | leds[78] = CRGB(255,255,255); 361 | leds[92] = CRGB(255,255,255); 362 | leds[80] = CRGB(255,255,255); 363 | leds[94] = CRGB(255,255,255); 364 | leds[81] = CRGB(255,255,255); 365 | leds[84] = CRGB(255,255,255); 366 | FastLED.show(); 367 | break; 368 | default: 369 | break; 370 | }; 371 | } 372 | void write_digit_four(int number) { 373 | switch (number) { 374 | case 1: 375 | leds[116] = CRGB(255,255,255); 376 | leds[120] = CRGB(255,255,255); 377 | leds[114] = CRGB(255,255,255); 378 | leds[122] = CRGB(255,255,255); 379 | leds[112] = CRGB(255,255,255); 380 | FastLED.show(); 381 | break; 382 | case 2: 383 | leds[105] = CRGB(255,255,255); 384 | leds[116] = CRGB(255,255,255); 385 | leds[120] = CRGB(255,255,255); 386 | leds[107] = CRGB(255,255,255); 387 | leds[114] = CRGB(255,255,255); 388 | leds[108] = CRGB(255,255,255); 389 | leds[109] = CRGB(255,255,255); 390 | leds[112] = CRGB(255,255,255); 391 | FastLED.show(); 392 | break; 393 | case 3: 394 | leds[105] = CRGB(255,255,255); 395 | leds[116] = CRGB(255,255,255); 396 | leds[120] = CRGB(255,255,255); 397 | leds[107] = CRGB(255,255,255); 398 | leds[114] = CRGB(255,255,255); 399 | leds[122] = CRGB(255,255,255); 400 | leds[109] = CRGB(255,255,255); 401 | leds[112] = CRGB(255,255,255); 402 | FastLED.show(); 403 | break; 404 | case 4: 405 | leds[105] = CRGB(255,255,255); 406 | leds[106] = CRGB(255,255,255); 407 | leds[107] = CRGB(255,255,255); 408 | leds[120] = CRGB(255,255,255); 409 | leds[114] = CRGB(255,255,255); 410 | leds[113] = CRGB(255,255,255); 411 | leds[109] = CRGB(255,255,255); 412 | FastLED.show(); 413 | break; 414 | case 5: 415 | leds[105] = CRGB(255,255,255); 416 | leds[116] = CRGB(255,255,255); 417 | leds[106] = CRGB(255,255,255); 418 | leds[107] = CRGB(255,255,255); 419 | leds[114] = CRGB(255,255,255); 420 | leds[122] = CRGB(255,255,255); 421 | leds[109] = CRGB(255,255,255); 422 | leds[112] = CRGB(255,255,255); 423 | FastLED.show(); 424 | break; 425 | case 6: 426 | leds[116] = CRGB(255,255,255); 427 | leds[115] = CRGB(255,255,255); 428 | leds[107] = CRGB(255,255,255); 429 | leds[114] = CRGB(255,255,255); 430 | leds[108] = CRGB(255,255,255); 431 | leds[122] = CRGB(255,255,255); 432 | leds[109] = CRGB(255,255,255); 433 | leds[112] = CRGB(255,255,255); 434 | FastLED.show(); 435 | break; 436 | case 7: 437 | leds[105] = CRGB(255,255,255); 438 | leds[116] = CRGB(255,255,255); 439 | leds[120] = CRGB(255,255,255); 440 | leds[114] = CRGB(255,255,255); 441 | leds[114] = CRGB(255,255,255); 442 | leds[113] = CRGB(255,255,255); 443 | leds[109] = CRGB(255,255,255); 444 | FastLED.show(); 445 | break; 446 | case 8: 447 | leds[105] = CRGB(255,255,255); 448 | leds[116] = CRGB(255,255,255); 449 | leds[106] = CRGB(255,255,255); 450 | leds[120] = CRGB(255,255,255); 451 | leds[107] = CRGB(255,255,255); 452 | leds[114] = CRGB(255,255,255); 453 | leds[108] = CRGB(255,255,255); 454 | leds[122] = CRGB(255,255,255); 455 | leds[109] = CRGB(255,255,255); 456 | leds[112] = CRGB(255,255,255); 457 | FastLED.show(); 458 | break; 459 | case 9: 460 | leds[105] = CRGB(255,255,255); 461 | leds[116] = CRGB(255,255,255); 462 | leds[106] = CRGB(255,255,255); 463 | leds[120] = CRGB(255,255,255); 464 | leds[107] = CRGB(255,255,255); 465 | leds[114] = CRGB(255,255,255); 466 | leds[113] = CRGB(255,255,255); 467 | leds[109] = CRGB(255,255,255); 468 | FastLED.show(); 469 | break; 470 | case 0: 471 | leds[105] = CRGB(255,255,255); 472 | leds[116] = CRGB(255,255,255); 473 | leds[106] = CRGB(255,255,255); 474 | leds[120] = CRGB(255,255,255); 475 | leds[108] = CRGB(255,255,255); 476 | leds[122] = CRGB(255,255,255); 477 | leds[109] = CRGB(255,255,255); 478 | leds[112] = CRGB(255,255,255); 479 | FastLED.show(); 480 | break; 481 | default: 482 | break; 483 | }; 484 | } 485 | 486 | // War eagle lights 487 | int war[] = { 488 | 7,17,16,24,25,28,39,42,53,38,30,31,21,35,45,44,52, 489 | 67,66,58,59,49,60,63,73,72,80,81,65, 490 | 95,94,86,87,77,88,91,102,106,100,93,108,109}; 491 | 492 | int eagle[] = { 493 | 5,8,9,15,14,25,28,16,23,7,18, // E 494 | 32,36,37,43,42,35,46,59,51,44,57,56, // A 495 | 63,60,49,59,58,66,67,70,81,80,72,65, // G 496 | 77,87,86,94,95, // L 497 | 105,102,91,101,100,108,109,112,123,107,114}; // E 498 | 499 | void war_eagle() { 500 | // BLUE WHITE ORANGE order of assign Blue background, orange letters, white perimeter. 501 | // Blue 12,35,64 502 | // Orange 242,101,34 503 | // Write war 504 | 505 | // Blue 506 | for (int i=0; i=0; i--) { 590 | leds[row7[i]] = CRGB(255,0,255); 591 | FastLED.show(); 592 | delay(delayt); 593 | } 594 | 595 | // ORANGE Second Row: left to right 596 | for (int i=0; i<18; i++) { 597 | leds[row2[i]] = CRGB(255,60,0); 598 | FastLED.show(); 599 | delay(delayt); 600 | } 601 | 602 | // BLUE Sixth Row: right to left 603 | for (int i=17; i>=0; i--) { 604 | leds[row6[i]] = CRGB(0,0,255); 605 | FastLED.show(); 606 | delay(delayt); 607 | } 608 | 609 | // YELLOW Third row: left to right 610 | for (int i=0; i<19; i++) { 611 | leds[row3[i]] = CRGB(255,255,0); 612 | FastLED.show(); 613 | delay(delayt); 614 | } 615 | 616 | // GREEN Fifth row: right to left 617 | for (int i=18; i>=0; i--) { 618 | leds[row5[i]] = CRGB(0,255,0); 619 | FastLED.show(); 620 | delay(delayt); 621 | } 622 | 623 | // WHITE 4th Row 624 | for (int i=0; i<10; i++) { 625 | leds[row4[10+i]] = CRGB(255,255,255); 626 | leds[row4[10-i]] = CRGB(255,255,255); 627 | FastLED.show(); 628 | delay(delayt); 629 | } 630 | leds[row4[0]] = CRGB(255,255,255); 631 | FastLED.show(); 632 | int FastLED_fade_counter; 633 | for ( int i = 0; i < NUM_LEDS; i++ ) 634 | { 635 | leds[i].maximizeBrightness(FastLED_fade_counter); // 'FastLED_fade_counter' How high we want to fade up to 255 = maximum. 636 | FastLED.show(); 637 | FastLED_fade_counter ++ ; // Increment 638 | } 639 | 640 | delay(400); 641 | FastLED.clear(); 642 | FastLED.show(); 643 | } 644 | 645 | void constant_background_color(int red, int green, int blue) { 646 | for (int i=0; i(leds, NUM_LEDS); 701 | 702 | //irrecv.enableIRIn(); 703 | //irrecv.blink13(true); 704 | FastLED.setMaxPowerInVoltsAndMilliamps(5,500); 705 | FastLED.clear(); 706 | FastLED.show(); 707 | 708 | } 709 | 710 | void unit_test_numbers() { 711 | for (int i=0; i<10; i++) { 712 | constant_background_color(0,255-10*i,10*i); 713 | write_time(i,i,i,i); 714 | delay(900); 715 | FastLED.clear(); 716 | FastLED.show(); 717 | } 718 | } 719 | 720 | void gradual_gradient_shift() { 721 | int delay1 = 500; 722 | for (int i=0; i 8 | #define LED_PIN 2 // LED Pin for controlling LED address 9 | #define NUM_LEDS 128 // Defining the number of addressable LEDs used in the circuit 10 | #define CLOCK_MODE 6 // Pin definition for the clock mode digital input. 11 | #define SET_TIME 7 // Pin definition for the set time mode digital input. 12 | #define PATTERN A0 // Pin definition for the potentiometer/pattern set analog input. 13 | 14 | // ************************************************ GLOBAL VARIABLES AND STRUCTURES ************************************************ 15 | CRGB leds[NUM_LEDS]; // Array creation of leds - allows the LED to be address using array [] notation. 16 | int clock_mode_reading; // Switch input reading for clock mode (display time vs show pattern) 17 | int set_time_reading; // Switch input reading for set time mode. Changes how fast time increases. 18 | int pattern_setting; // Analog potentiometer reading for pattern mode. Changes which pattern is displayed. 19 | int d1 = 0; // 10s digit of hour 20 | int d2 = 0; // 1s digit of hour 21 | int d3 = 0; // 10s digit of minute 22 | int d4 = 1; // 1s digit of minute 23 | 24 | // LED assignments of each individual digit of time. Currently not used for purposes other than debugging. 25 | int first_digit[12] = {7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 22, 24}; 26 | int second_digit[12] = {35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 50, 52}; 27 | int third_digit[12] = {77, 78, 79, 80, 81, 84, 85, 86, 87, 88, 92, 94}; 28 | int fourth_digit[12] = {105, 106, 107, 108, 109, 112, 113, 114, 115, 116, 120, 122}; 29 | int background[78] = {0,1,2,3,4,5,6,13,19,29,21,22,25,26,27,28,30,31,32,33,34, 40,41,47,48,49,51,53, 30 | 54,55,56,57,58,69,60,61,62,63,65,67,68,69, 70,71,72,73,74,75,76, 82,83, 89, 90, 31 | 91,93,95,96,97,98,99,100,101,102,103,104,111,117,118,119,121,123,124,125,126,127}; 32 | 33 | // LED assignments of each row of seven available rows. Used when creating backgrounds. 34 | int row1[17] = {6,19,20,33,34,47,48,61,62,75,76,89,90,103,104,117,118}; 35 | int row2[18] = {5,7,18,21,32,35,46,49,60,63,74,77,88,91,102,105,116,119}; 36 | int row3[19] = {4,8,17,22,31,36,45,50,59,64,73,78,87,92,101,106,115,120,127}; 37 | int row4[20] = {0,3,9,16,23,30,37,44,51,58,65,72,79,86,93,100,107,114,121,126}; 38 | int row5[19] = {2,10,15,24,29,38,43,52,57,66,71,80,85,94,99,108,113,122,125}; 39 | int row6[18] = {1,11,14,25,28,39,42,53,56,67,70,81,84,95,98,109,112,123}; 40 | int row7[17] = {12,13,26,27,40,41,54,55,68,69,82,83,96,97,110,111,124}; 41 | 42 | // LED assignment of the clock perimeter 43 | int perimeter[] = {0,2,1,12,13,26,27,40,41,54,55,68,69,82,83,96,97,110,111,124,123,125,126,127,119,118,117, 44 | 104,103,90,89,76,75,62,61,48,47,34,33,20,19,6,5,4}; 45 | 46 | // ************************************************ END GLOBALS ******************************************************** 47 | 48 | // ************************************************ BACKGROUND PATTERNS ************************************************ 49 | 50 | void LightRowsOppositeandConverge() { 51 | int delayt = 20; 52 | // RED First row :left to right 53 | for (int i=0; i<17; i++) { 54 | leds[row1[i]] = CRGB(255,0,0); 55 | FastLED.show(); 56 | delay(delayt); 57 | } 58 | 59 | // PURPLE Seventh Row: right to left 60 | for (int i=16; i>=0; i--) { 61 | leds[row7[i]] = CRGB(255,0,255); 62 | FastLED.show(); 63 | delay(delayt); 64 | } 65 | 66 | // ORANGE Second Row: left to right 67 | for (int i=0; i<18; i++) { 68 | leds[row2[i]] = CRGB(255,60,0); 69 | FastLED.show(); 70 | delay(delayt); 71 | } 72 | 73 | // BLUE Sixth Row: right to left 74 | for (int i=17; i>=0; i--) { 75 | leds[row6[i]] = CRGB(0,0,255); 76 | FastLED.show(); 77 | delay(delayt); 78 | } 79 | 80 | // YELLOW Third row: left to right 81 | for (int i=0; i<19; i++) { 82 | leds[row3[i]] = CRGB(255,255,0); 83 | FastLED.show(); 84 | delay(delayt); 85 | } 86 | 87 | // GREEN Fifth row: right to left 88 | for (int i=18; i>=0; i--) { 89 | leds[row5[i]] = CRGB(0,255,0); 90 | FastLED.show(); 91 | delay(delayt); 92 | } 93 | 94 | // WHITE 4th Row 95 | for (int i=0; i<10; i++) { 96 | leds[row4[10+i]] = CRGB(255,255,255); 97 | leds[row4[10-i]] = CRGB(255,255,255); 98 | FastLED.show(); 99 | delay(delayt); 100 | } 101 | leds[row4[0]] = CRGB(255,255,255); 102 | FastLED.show(); 103 | int FastLED_fade_counter; 104 | for ( int i = 0; i < NUM_LEDS; i++ ) 105 | { 106 | leds[i].maximizeBrightness(FastLED_fade_counter); // 'FastLED_fade_counter' How high we want to fade up to 255 = maximum. 107 | FastLED.show(); 108 | FastLED_fade_counter ++ ; // Increment 109 | } 110 | 111 | delay(50); 112 | FastLED.clear(); 113 | FastLED.show(); 114 | } 115 | 116 | void RandomLEDandColor() { 117 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 118 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 119 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 120 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 121 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 122 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 123 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 124 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 125 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 126 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 127 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 128 | leds[random(128)] = CRGB(random(255), random(255), random(255)); 129 | FastLED.show(); 130 | delay(200); 131 | FastLED.clear(); 132 | } 133 | 134 | void PongMovingRainbow() { 135 | // Red to Orange 136 | for (int i=0; i 9) { 689 | d4 = 0; 690 | d3 += 1; 691 | } 692 | if (d3 == 6) { 693 | d3 = 0; 694 | d2 += 1; 695 | } 696 | if (d2 == 3 && d1 == 1) { 697 | d2 =1; 698 | d1 = 0; 699 | } 700 | if (d2 == 10) { 701 | d2 = 0; 702 | d1 += 1; 703 | } 704 | if (d1 == 2) { 705 | d1 == 0; 706 | } 707 | if (d2 == 2){ 708 | if (d1 == 1) { 709 | d2 == 0; 710 | d1 == 0; 711 | } 712 | } 713 | } 714 | 715 | // ********************************************* END TIME FUNCTIONS *************************************************** 716 | 717 | 718 | // ************************************************ MAIN FUNCTIONS ************************************************ 719 | void setup() { 720 | Serial.begin(9600); 721 | pinMode(SET_TIME, INPUT); 722 | pinMode(CLOCK_MODE, INPUT); 723 | pinMode(PATTERN, INPUT); 724 | FastLED.addLeds(leds, NUM_LEDS); 725 | FastLED.setMaxPowerInVoltsAndMilliamps(5,500); 726 | FastLED.clear(); 727 | FastLED.show(); 728 | } 729 | 730 | void loop() { 731 | 732 | // Step 1. Take all initial measurements from mode switch, time swich, and 733 | // potentiometer, and store them in respective variables. 734 | 735 | set_time_reading = digitalRead(SET_TIME); 736 | clock_mode_reading = digitalRead(CLOCK_MODE); 737 | pattern_setting = analogRead(PATTERN); 738 | 739 | 740 | // Step 2. Configure LEDs based on switch reading. General logic, is that if the clock is in 741 | // pattern mode, display a pattern that the user can change with the potentiometer. If the 742 | // clock is in time mode, update the time every 60 seconds. If the user is in time mode 743 | // and the set time switch is enabled, update the time every 300 milliseconds to allow the 744 | // user to set the time. Flip the switch back to turn on refresh rate to 60 seconds. 745 | 746 | // This would really work best with parallel computing, because here it is easy to get stuck 747 | // in the 60 second loop with no idea what the state of the buttons is. 748 | 749 | // clock_mode_reading == 1 --> Background mode 750 | // clock_mode_reading == 0 --> Time mode 751 | // set_time_reading == 1 --> Fast refresh to set precise time 752 | // set_time_reading == 0 --> 60 second refresh rate for time. 753 | 754 | 755 | if (clock_mode_reading == 1) { 756 | // Analog read pot setting for background 757 | if (pattern_setting < 300) { 758 | FastLED.clear(); 759 | FastLED.show(); 760 | LightRowsOppositeandConverge(); 761 | } 762 | else if (pattern_setting < 600) { 763 | FastLED.clear(); 764 | FastLED.show(); 765 | PongMovingRainbow(); 766 | } 767 | else if (pattern_setting < 1000) { 768 | FastLED.clear(); 769 | FastLED.show(); 770 | RandomLEDandColor(); 771 | } 772 | } 773 | 774 | if (clock_mode_reading == 0) { 775 | if (set_time_reading == 1) { 776 | update_time(50); 777 | } 778 | else { 779 | update_time(60000); 780 | } 781 | } 782 | } 783 | 784 | // ************************************************ END MAIN FUNCTIONS ************************************************ 785 | -------------------------------------------------------------------------------- /ShiftRegister/ShiftRegisterTutorial.ino: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | /* 4 | * init function 5 | * writeByte 6 | */ 7 | 8 | void SR595N_init( Shift_Register_595N * const sr ) 9 | { 10 | pinMode( sr->SER, OUTPUT); 11 | pinMode( sr->RCLK, OUTPUT); 12 | pinMode( sr->SCLK, OUTPUT); 13 | } 14 | 15 | void SR165_init( Shift_Register_165 * const sr ) 16 | { 17 | pinMode(sr->CLK, OUTPUT); 18 | pinMode(sr->CLK_INH, OUTPUT); 19 | pinMode(sr->QH, INPUT); 20 | pinMode(sr->SHLD , OUTPUT); 21 | 22 | // Default states 23 | digitalWrite ( sr-> SHLD, HIGH); 24 | digitalWrite ( sr->CLK_INH, HIGH); 25 | digitalWrite ( sr->CLK, LOW); 26 | } 27 | 28 | /* Byte value, and write LSB to data pin , pulse SCLK, shift value by >> 1, repeat 8x. Pulse OUT REG 29 | * 0b11011011 30 | */ 31 | void SR595N_writeByte ( const Shift_Register_595N * const sr , byte val ) 32 | { 33 | uint8_t counter; 34 | byte shiftVal; 35 | 36 | for ( counter = 0; counter < NUM_BITS_IN_BYTE ; counter++ ) 37 | { 38 | shiftVal = ( val & 0x01 ); 39 | digitalWrite ( sr->SER, shiftVal ); 40 | digitalWrite ( sr->SCLK, HIGH); 41 | digitalWrite ( sr->SCLK, LOW); 42 | val = val >> 1; 43 | } 44 | digitalWrite ( sr->RCLK, HIGH); 45 | digitalWrite ( sr->RCLK, LOW); 46 | } 47 | 48 | /* To read a byte, capture all inputs to SR ( 49 | * 50 | */ 51 | void SR165_readByte ( const Shift_Register_165 * const sr, 52 | uint8_t * const readVal) 53 | { 54 | // Pulse SHLD to transfer data inside the SR 55 | digitalWrite( sr->SHLD, LOW); 56 | digitalWrite( sr->SHLD, HIGH); 57 | 58 | // Set CLKINH low, 59 | digitalWrite ( sr->CLK_INH, LOW); 60 | 61 | // Loop through SR 8 times to transfer value bit by bit 62 | uint8_t counter; 63 | uint8_t shiftVal = 0x0; 64 | for ( counter = 0; counter < NUM_BITS_IN_BYTE ; counter++ ) 65 | { 66 | digitalWrite( sr->CLK, HIGH); 67 | digitalWrite(sr->CLK, LOW); 68 | shiftVal |= ( digitalRead(sr->QH) & 0x01); 69 | shiftVal = ( shiftVal << 1 ) ; 70 | } 71 | digitalWrite (sr->CLK_INH, HIGH); 72 | *readVal = shiftVal; 73 | } 74 | 75 | Shift_Register_595N sr1 = 76 | { 77 | .SER = 4, 78 | .RCLK = 5, 79 | .SCLK = 6 80 | }; 81 | 82 | Shift_Register_165 sr2 = 83 | { 84 | .CLK = 9, 85 | .CLK_INH = 8, 86 | .QH = 10, 87 | .SHLD = 7 88 | }; 89 | 90 | void setup() 91 | { 92 | SR595N_init ( &sr1 ); 93 | SR165_init ( &sr2 ); 94 | Serial.begin(115200); 95 | } 96 | 97 | uint8_t readVal = 0; 98 | void loop() 99 | { 100 | SR595N_writeByte ( &sr1, 0x3); 101 | SR165_readByte ( &sr2, &readVal); 102 | Serial.println(readVal); 103 | delay(100); 104 | } 105 | -------------------------------------------------------------------------------- /ShiftRegister/types.h: -------------------------------------------------------------------------------- 1 | #define NUM_BITS_IN_BYTE 8 2 | 3 | typedef struct Shift_Register_t_595N_t 4 | { 5 | byte SER; 6 | byte RCLK; 7 | byte SCLK; 8 | } Shift_Register_595N; 9 | 10 | typedef struct Shift_Register_165_t 11 | { 12 | byte CLK; 13 | byte CLK_INH; 14 | byte QH; 15 | byte SHLD; 16 | }Shift_Register_165; 17 | -------------------------------------------------------------------------------- /lcd.ino: -------------------------------------------------------------------------------- 1 | /* ===================================== 2 | Arduino 1602 LCD Tutorial 3 | Date: 12-21-2019 4 | Author: Henry Gilbert 5 | ===================================== 6 | _______________________________________________________________ 7 | | 1602 LCD Pin Diagram | 8 | | | 9 | |VSS VDD VO RS RW E D0 D1 D2 D3 D4 D5 D6 D7 A K | 10 | |_______________________________________________________________| 11 | 12 | GND: VSS, RW, K 13 | 5V: VDD, V0, A 14 | "V0" runs through a potentiometer 15 | "A" uses a 220 Ohm resistor 16 | Arduino: RS, E D3, D4, D5, D6, 17 | 18 | 19 | Must include 20 | Object constructor: 21 | LiquidCrystal lcd(rs, e, d4, d5, d6, d7) 22 | 23 | Code required in setup: 24 | lcd.begin(r,c) --> If using a 16x4 25 | 26 | Methods: 27 | 28 | lcd.clear() 29 | lcd.setCursor(r, c) 30 | lcd.print() 31 | */ 32 | 33 | 34 | #include 35 | int rs = 2; 36 | int e = 3; 37 | int d4 = 4; 38 | int d5 = 5; 39 | int d6 = 6; 40 | int d7 = 7; 41 | 42 | LiquidCrystal lcd(rs, e, d4, d5, d6, d7); 43 | 44 | 45 | 46 | void setup(){ 47 | lcd.begin(16, 2); 48 | } 49 | 50 | int n = 0; 51 | 52 | void loop() { 53 | lcd.setCursor(0,0); 54 | delay(1000); 55 | n+= 1; 56 | lcd.print(n); 57 | } 58 | -------------------------------------------------------------------------------- /potentiometer_switch.ino: -------------------------------------------------------------------------------- 1 | const int led1 = 5; 2 | const int led2 = 6; 3 | const int led3 = 7; 4 | const int led4 = 8; 5 | const int potin = A0; 6 | // Potentiometer values: 0-260-520-780 7 | 8 | void setup() 9 | { 10 | pinMode(led1, OUTPUT); 11 | pinMode(led2, OUTPUT); 12 | pinMode(led3, OUTPUT); 13 | pinMode(led4, OUTPUT); 14 | pinMode(potin, INPUT); 15 | Serial.begin(9600); 16 | } 17 | 18 | void clear_leds() { 19 | digitalWrite(led1, LOW); 20 | digitalWrite(led2, LOW); 21 | digitalWrite(led3, LOW); 22 | digitalWrite(led4, LOW); 23 | } 24 | 25 | void loop() 26 | { 27 | int val = analogRead(potin); 28 | Serial.println(val); 29 | if (val < 260) { 30 | clear_leds(); 31 | digitalWrite(led1, HIGH); 32 | } 33 | else if (val < 520) { 34 | clear_leds(); 35 | digitalWrite(led2, HIGH); 36 | } 37 | else if (val < 780) { 38 | clear_leds(); 39 | digitalWrite(led3, HIGH); 40 | } 41 | else if (val < 1023) { 42 | clear_leds(); 43 | digitalWrite(led4, HIGH); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /sevenSeg/ControlPanelDriver.ino: -------------------------------------------------------------------------------- 1 | #include "typedefs.h" 2 | 3 | /* Function prototypes, move to separate files during pic implementation */ 4 | void InitializeSevenSegmentDisplay ( Seven_Seg_Display * disp, 5 | SEVEN_SEGMENT_POWER_CONFIGURATION pwrCfg, 6 | Shift_Register * shiftReg, 7 | Digit_Pin_Config * digitConfig); 8 | static void convertNumberInputToShiftRegisterValue( Seven_Seg_Display *val); 9 | static void shiftValueOut( Seven_Seg_Display *val ); 10 | bool WriteSSNumber( Seven_Seg_Display *const disp, 11 | const float value); 12 | 13 | static const Digit_Pin_Config digit1Cfg = 14 | { 15 | .digit1 = 7, 16 | .digit2 = 4, 17 | .digit3 = 5, 18 | .digit4 = 6 19 | }; 20 | 21 | static const Shift_Register d1SR = 22 | { 23 | .SER = 8, 24 | .RCLK = 9, 25 | .SCLK = 10 26 | }; 27 | 28 | uint16_t rotCounter; 29 | uint32_t rotVector; 30 | 31 | void rotISR() 32 | { 33 | rotVector = ( rotVector << 2u ) & 0xCu; 34 | rotVector |= ( digitalRead(2) ) ? 2: 0; 35 | rotVector |= ( digitalRead(3) ) ? 1: 0; 36 | // Serial.println(rotVector); 37 | switch ( rotVector ) 38 | { 39 | case 15: 40 | rotCounter++; 41 | break; 42 | case 5: 43 | rotCounter--; 44 | break; 45 | } 46 | } 47 | 48 | Seven_Seg_Display display1; 49 | 50 | 51 | void setup() 52 | { 53 | InitializeSevenSegmentDisplay( &display1, 54 | COMMON_ANODE, 55 | &d1SR, 56 | &digit1Cfg); 57 | attachInterrupt( digitalPinToInterrupt(3), rotISR, RISING); 58 | Serial.begin(115200); 59 | } 60 | 61 | void loop() 62 | { 63 | // Write rotary encoder value 64 | // for ( counter = 0; counter < 9999; counter ++ ) 65 | // { 66 | // WriteSSNumber ( &display1, counter); 67 | // delay(20); 68 | // } 69 | 70 | WriteSSNumber( &display1, rotCounter); 71 | } 72 | -------------------------------------------------------------------------------- /sevenSeg/a7segDisplay.ino: -------------------------------------------------------------------------------- 1 | #define MAX_VALUE_TO_WRITE 9999 2 | #define MAX_POSSIBLE_VALUES_TO_WRITE 10 3 | #define NUM_DIGITS 4 4 | // Listen MSB on the left. These are shfiteed 5 | static uint8_t digitArray[4]; // this is populated based on configuration data to make the digit iterable. 6 | 7 | static const uint8_t writeTable[MAX_POSSIBLE_VALUES_TO_WRITE] = 8 | { 9 | 0b11111100, // zero 10 | 0b01100000, // one 11 | 0b11011010, // two 12 | 0b11110010, // three 13 | 0b01100110, // four 14 | 0b10110110, // five 15 | 0b10111110, // six 16 | 0b11100000, // seven 17 | 0b11111110, // eight 18 | 0b11100110, // nine 19 | }; // set these up with 1 as active high. follow standard convention then set later as configuration 20 | 21 | void InitializeSevenSegmentDisplay ( Seven_Seg_Display * disp, 22 | SEVEN_SEGMENT_POWER_CONFIGURATION pwrCfg, 23 | Shift_Register * shiftReg, 24 | Digit_Pin_Config * digitConfig) 25 | { 26 | // Parameter checks 27 | if ((NULL == disp)|| 28 | (NULL == shiftReg) || 29 | (NULL == digitConfig)) 30 | { 31 | return; // Invalid params 32 | } 33 | /* Common anode is active LOW, common cathode is active HIGH */ 34 | disp->segmentON = ( pwrCfg == COMMON_ANODE ) ? 0: 1; 35 | disp->segmentOFF = ( pwrCfg == COMMON_ANODE ) ? 1: 0; 36 | 37 | /* Common anode requires digits actie HIGH. Cathode requires digits active LOW */ 38 | disp->enableDigit = ( pwrCfg == COMMON_ANODE ) ? 1: 0; 39 | disp->disableDigit = ( pwrCfg == COMMON_ANODE ) ? 0: 1; 40 | 41 | /* Setup shift register with display */ 42 | disp->sr = shiftReg; 43 | disp->digitCfg = digitConfig; 44 | 45 | // TODO run parameter checks on these pins, ensure they aren't jank. 46 | 47 | pinMode ( shiftReg->SCLK, OUTPUT); 48 | pinMode ( shiftReg->SER, OUTPUT); 49 | pinMode ( shiftReg->RCLK, OUTPUT); 50 | 51 | pinMode ( digitConfig->digit1, OUTPUT); 52 | pinMode ( digitConfig->digit2, OUTPUT); 53 | pinMode ( digitConfig->digit3, OUTPUT); 54 | pinMode ( digitConfig->digit4, OUTPUT); 55 | 56 | /* Setup iterable array for digit configs */ 57 | digitArray[0] = digitConfig->digit1; 58 | digitArray[1] = digitConfig->digit2; 59 | digitArray[2] = digitConfig->digit3; 60 | digitArray[3] = digitConfig->digit4; 61 | } 62 | 63 | /* Primary write function that hands all other function calls */ 64 | // TODO implement floating point and decimal point 65 | bool WriteSSNumber( Seven_Seg_Display *const disp, 66 | const float value) 67 | { 68 | uint16_t tempValue = uint16_t (value + 0.5) ; // Create a local copy of the input float value 69 | 70 | if (( NULL == disp ) || 71 | (tempValue > MAX_VALUE_TO_WRITE ) || 72 | ( tempValue < 0)) 73 | { 74 | return false; // Error, invalid value 75 | } 76 | 77 | // Decompose floating point number 78 | uint8_t numDigitsInNumber = log10(tempValue) + 1 ; // Digit cant be zero because func would have exited 79 | uint8_t writeArray[NUM_DIGITS] = {0,0,0,0}; // Must zero the array upon restart - verify this is required. 80 | uint8_t writeIndex = 3; // Start the write index at the end of the write array. 81 | 82 | while ( numDigitsInNumber > 0) 83 | { 84 | writeArray[writeIndex] = ( tempValue %10 ); 85 | tempValue = tempValue / 10; 86 | writeIndex--; 87 | numDigitsInNumber--; 88 | } 89 | WriteSevenSegmentValue ( disp, writeArray ); 90 | } 91 | 92 | /* Primary segment digit write. Assumes the value has been translated into a valid write array */ 93 | static void WriteSevenSegmentValue(Seven_Seg_Display *const disp, 94 | const uint8_t * const writeArray) 95 | { 96 | // todo add checks 97 | uint8_t digitCounter; 98 | uint16_t delayVal = 1; 99 | uint8_t sval; 100 | /* For every digit in the digit array (4) */ 101 | for ( digitCounter = 0; digitCounter < NUM_DIGITS; digitCounter++) 102 | { 103 | /* Extract the value from the write array corresponding to the segment decoded value */ 104 | sval = writeTable[writeArray[digitCounter]]; // nth digit from input array. Extracts value from global write table 105 | for (int counter = 0; counter < 8; counter++ ) 106 | { 107 | shiftValueOut ( disp->sr, (sval & 0x1 ) ? disp->segmentON :disp->segmentOFF ); 108 | sval = sval >> 1; 109 | } 110 | /* Pulse the refresh clock on the shift register */ 111 | digitalWrite(disp->sr->RCLK, HIGH); 112 | digitalWrite(disp->sr->RCLK, LOW); 113 | /* Enable then disable the digit after a specified delay */ 114 | digitalWrite (digitArray[digitCounter], disp->enableDigit); 115 | delay(delayVal); 116 | digitalWrite (digitArray[digitCounter], disp->disableDigit); 117 | } 118 | } 119 | 120 | 121 | /* Shifts a single bit out to the shift register. Only real "shift register" function. */ 122 | /* Can eventually implement further functionality based on SR. But this is all we need right now */ 123 | static inline void shiftValueOut( const Shift_Register *const sr, const uint8_t value ) 124 | { 125 | digitalWrite(sr->SER, value); 126 | digitalWrite(sr->SCLK, HIGH); 127 | digitalWrite(sr->SCLK, LOW); 128 | } 129 | -------------------------------------------------------------------------------- /sevenSeg/readme: -------------------------------------------------------------------------------- 1 | Read me for seven seg display 2 | -------------------------------------------------------------------------------- /sevenSeg/rotaryEncoder.ino: -------------------------------------------------------------------------------- 1 | //uint16_t rotCounter; 2 | //uint32_t rotVector; 3 | // 4 | //void rotISR() 5 | //{ 6 | // rotVector = ( rotVector << 2u ) & 0xCu; 7 | // rotVector |= ( digitalRead(2) ) ? 2: 0; 8 | // rotVector |= ( digitalRead(3) ) ? 1: 0; 9 | // //Serial.println(rotVector); 10 | // switch ( rotVector ) 11 | // { 12 | // case 8: 13 | // rotCounter++; 14 | // break; 15 | // case 4: 16 | // rotCounter--; 17 | // break; 18 | // } 19 | //} 20 | -------------------------------------------------------------------------------- /sevenSeg/typedefs.h: -------------------------------------------------------------------------------- 1 | /* Shift register files */ 2 | typedef struct Shift_Register_t 3 | { 4 | const uint8_t SER; 5 | const uint8_t RCLK; 6 | const uint8_t SCLK; 7 | } Shift_Register; 8 | 9 | /* Seven segment configuration values */ 10 | typedef enum SEVEN_SEGMENT_POWER_CONFIGURATION_t 11 | { 12 | COMMON_ANODE, 13 | COMMON_CATHODE 14 | } SEVEN_SEGMENT_POWER_CONFIGURATION; 15 | 16 | typedef struct Digit_Pin_Config_t 17 | { 18 | const uint8_t digit1; 19 | const uint8_t digit2; 20 | const uint8_t digit3; 21 | const uint8_t digit4; 22 | } Digit_Pin_Config; 23 | 24 | typedef struct Seven_Seg_Display_t 25 | { 26 | /* segment and digit enables are set from power config enum 8*/ 27 | uint8_t segmentON; 28 | uint8_t segmentOFF; 29 | uint8_t enableDigit; 30 | uint8_t disableDigit; 31 | Shift_Register * sr; 32 | const Digit_Pin_Config * digitCfg; 33 | 34 | } Seven_Seg_Display; 35 | 36 | /* Rotary Encoder struct */ 37 | 38 | typedef struct Rotary_Encoder_t 39 | { 40 | uint32_t counts; 41 | uint8_t pinA; 42 | uint8_t pinB; 43 | uint8_t pinSW; 44 | uint8_t pulseConfig; 45 | } Rotary_Encoder; 46 | --------------------------------------------------------------------------------