1st tests
This commit is contained in:
commit
47914a7650
|
@ -0,0 +1,34 @@
|
||||||
|
#include "SevSeg.h"
|
||||||
|
SevSeg sevseg;
|
||||||
|
|
||||||
|
#include "animations.h"
|
||||||
|
|
||||||
|
// Variables globales
|
||||||
|
int frameId = 0; // début
|
||||||
|
int frameAnim = 0; // début
|
||||||
|
int animId = 0; // début
|
||||||
|
int loopFrames = 10000;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
byte numDigits = 4;
|
||||||
|
byte digitPins[] = {7, 8, 9, 6};
|
||||||
|
byte segmentPins[] = {10, 12, 14, 16, 17, 11, 13, 15};
|
||||||
|
|
||||||
|
bool resistorsOnSegments = true;
|
||||||
|
bool updateWithDelaysIn = true;
|
||||||
|
byte hardwareConfig = COMMON_CATHODE;
|
||||||
|
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments);
|
||||||
|
sevseg.setBrightness(90);
|
||||||
|
}
|
||||||
|
void loop(){
|
||||||
|
sevseg.refreshDisplay();
|
||||||
|
//sevseg.setNumber(8888, 1);
|
||||||
|
sevseg.setNumber(frameAnim, 3);
|
||||||
|
// système pour augmenter le compteur et créer un système de vitesse
|
||||||
|
frameId++;
|
||||||
|
if (frameId > loopFrames)
|
||||||
|
{
|
||||||
|
frameAnim++;
|
||||||
|
frameId = 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,246 @@
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION1[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x01 }, // Frame 1
|
||||||
|
{ 0x00, 0x00, 0x01, 0x00 }, // Frame 2
|
||||||
|
{ 0x00, 0x01, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x01, 0x00, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x20, 0x00, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x10, 0x00, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 7
|
||||||
|
{ 0x00, 0x08, 0x00, 0x00 }, // Frame 8
|
||||||
|
{ 0x00, 0x00, 0x08, 0x00 }, // Frame 9
|
||||||
|
{ 0x00, 0x00, 0x00, 0x08 }, // Frame 10
|
||||||
|
{ 0x00, 0x00, 0x00, 0x04 }, // Frame 11
|
||||||
|
{ 0x00, 0x00, 0x00, 0x02 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x01, 0x01 }, // Frame 13
|
||||||
|
{ 0x01, 0x01, 0x00, 0x00 }, // Frame 14
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 15
|
||||||
|
{ 0x08, 0x08, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x00, 0x00, 0x08, 0x08 }, // Frame 17
|
||||||
|
{ 0x00, 0x00, 0x00, 0x06 }, // Frame 18
|
||||||
|
{ 0x00, 0x01, 0x01, 0x01 }, // Frame 19
|
||||||
|
{ 0x31, 0x00, 0x00, 0x00 }, // Frame 20
|
||||||
|
{ 0x08, 0x08, 0x08, 0x00 }, // Frame 21
|
||||||
|
{ 0x00, 0x00, 0x00, 0x0e }, // Frame 22
|
||||||
|
{ 0x01, 0x01, 0x01, 0x01 }, // Frame 23
|
||||||
|
{ 0x38, 0x08, 0x00, 0x00 }, // Frame 24
|
||||||
|
{ 0x00, 0x00, 0x08, 0x0e }, // Frame 25
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 26
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 27
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff }, // Frame 28
|
||||||
|
{ 0x9b, 0x9b, 0x9b, 0x9b } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION2[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x48, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x49, 0x00, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x49, 0x08, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x49, 0x48, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x49, 0x49, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x49, 0x49, 0x08, 0x00 }, // Frame 7
|
||||||
|
{ 0x49, 0x49, 0x48, 0x00 }, // Frame 8
|
||||||
|
{ 0x49, 0x49, 0x49, 0x00 }, // Frame 9
|
||||||
|
{ 0x49, 0x49, 0x49, 0x08 }, // Frame 10
|
||||||
|
{ 0x49, 0x49, 0x49, 0x48 }, // Frame 11
|
||||||
|
{ 0x49, 0x49, 0x49, 0x49 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 13
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 14
|
||||||
|
{ 0x5c, 0x00, 0x00, 0x00 }, // Frame 15
|
||||||
|
{ 0x7f, 0x00, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x7f, 0x08, 0x00, 0x00 }, // Frame 17
|
||||||
|
{ 0x7f, 0x5c, 0x00, 0x00 }, // Frame 18
|
||||||
|
{ 0x7f, 0x7f, 0x00, 0x00 }, // Frame 19
|
||||||
|
{ 0x7f, 0x7f, 0x08, 0x00 }, // Frame 20
|
||||||
|
{ 0x7f, 0x7f, 0x5c, 0x00 }, // Frame 21
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x00 }, // Frame 22
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x08 }, // Frame 23
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x5c }, // Frame 24
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 25
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 26
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 27
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION3[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x08, 0x00, 0x08, 0x00 }, // Frame 2
|
||||||
|
{ 0x08, 0x00, 0x08, 0x08 }, // Frame 3
|
||||||
|
{ 0x48, 0x08, 0x08, 0x08 }, // Frame 4
|
||||||
|
{ 0x48, 0x08, 0x48, 0x08 }, // Frame 5
|
||||||
|
{ 0x08, 0x08, 0x49, 0x49 }, // Frame 6
|
||||||
|
{ 0x08, 0x48, 0x48, 0x49 }, // Frame 7
|
||||||
|
{ 0x08, 0x48, 0x08, 0x49 }, // Frame 8
|
||||||
|
{ 0x08, 0x08, 0x08, 0x48 }, // Frame 9
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 10
|
||||||
|
{ 0x49, 0x08, 0x48, 0x48 }, // Frame 11
|
||||||
|
{ 0x49, 0x08, 0x49, 0x08 }, // Frame 12
|
||||||
|
{ 0x49, 0x08, 0x08, 0x08 }, // Frame 13
|
||||||
|
{ 0x48, 0x08, 0x08, 0x08 }, // Frame 14
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 15
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 16
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 17
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 18
|
||||||
|
{ 0x48, 0x48, 0x48, 0x48 }, // Frame 19
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 20
|
||||||
|
{ 0x08, 0x49, 0x49, 0x08 }, // Frame 21
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 22
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 23
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 24
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 25
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 26
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 27
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION4[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 1
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 2
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 3
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 4
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 5
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 6
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 7
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 8
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 9
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 10
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 11
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 12
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 13
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 14
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 15
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 16
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 17
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 18
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 19
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 20
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 21
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 22
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 23
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 24
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 25
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 27
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 28
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION5[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 3
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 4
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 5
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 6
|
||||||
|
{ 0x76, 0x00, 0x00, 0x06 }, // Frame 7
|
||||||
|
{ 0x70, 0x40, 0x00, 0x06 }, // Frame 8
|
||||||
|
{ 0x70, 0x00, 0x40, 0x06 }, // Frame 9
|
||||||
|
{ 0x70, 0x00, 0x00, 0x46 }, // Frame 10
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 11
|
||||||
|
{ 0x70, 0x00, 0x00, 0x46 }, // Frame 12
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 13
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 14
|
||||||
|
{ 0x70, 0x00, 0x00, 0x0c }, // Frame 15
|
||||||
|
{ 0x70, 0x00, 0x00, 0x0c }, // Frame 16
|
||||||
|
{ 0x70, 0x00, 0x00, 0x88 }, // Frame 17
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 18
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 19
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 20
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 21
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 22
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 23
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 24
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 25
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 26
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 } // Frame 27
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION6[41][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 7
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 8
|
||||||
|
{ 0x06, 0x00, 0x00, 0x06 }, // Frame 9
|
||||||
|
{ 0x06, 0x00, 0x00, 0x30 }, // Frame 10
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 11
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 12
|
||||||
|
{ 0x00, 0x50, 0x06, 0x00 }, // Frame 13
|
||||||
|
{ 0x00, 0x50, 0x44, 0x00 }, // Frame 14
|
||||||
|
{ 0x00, 0x50, 0x44, 0x00 }, // Frame 15
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 16
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 17
|
||||||
|
{ 0x00, 0x70, 0x06, 0x00 }, // Frame 18
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 19
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 20
|
||||||
|
{ 0x00, 0x06, 0x46, 0x70 }, // Frame 21
|
||||||
|
{ 0x00, 0x06, 0x46, 0x46 }, // Frame 22
|
||||||
|
{ 0x00, 0x06, 0x46, 0x50 }, // Frame 23
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 24
|
||||||
|
{ 0x00, 0x06, 0x46, 0x00 }, // Frame 25
|
||||||
|
{ 0x00, 0x06, 0x06, 0x00 }, // Frame 26
|
||||||
|
{ 0x00, 0x06, 0x06, 0x00 }, // Frame 27
|
||||||
|
{ 0x00, 0x06, 0x0c, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x06, 0x0c, 0x00 }, // Frame 29
|
||||||
|
{ 0x00, 0x06, 0x88, 0x00 }, // Frame 30
|
||||||
|
{ 0x00, 0x06, 0x88, 0x00 }, // Frame 31
|
||||||
|
{ 0x00, 0x30, 0x88, 0x00 }, // Frame 32
|
||||||
|
{ 0x00, 0x30, 0x88, 0x00 }, // Frame 33
|
||||||
|
{ 0x06, 0x00, 0x88, 0x00 }, // Frame 34
|
||||||
|
{ 0x06, 0x00, 0x88, 0x00 }, // Frame 35
|
||||||
|
{ 0x30, 0x00, 0x88, 0x00 }, // Frame 36
|
||||||
|
{ 0x30, 0x00, 0x88, 0x00 }, // Frame 37
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 }, // Frame 38
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 }, // Frame 39
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 } // Frame 40
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION7[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x3c }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x3c, 0x1e }, // Frame 0
|
||||||
|
{ 0x00, 0x3c, 0x1e, 0x79 }, // Frame 0
|
||||||
|
{ 0x3c, 0x1e, 0x79, 0x38 }, // Frame 1
|
||||||
|
{ 0x1e, 0x79, 0x38, 0x39 }, // Frame 2
|
||||||
|
{ 0x79, 0x38, 0x39, 0x3f }, // Frame 3
|
||||||
|
{ 0x38, 0x39, 0x3f, 0x37 }, // Frame 4
|
||||||
|
{ 0x39, 0x3f, 0x37, 0x79 }, // Frame 5
|
||||||
|
{ 0x3f, 0x37, 0x79, 0x00 }, // Frame 6
|
||||||
|
{ 0x37, 0x79, 0x00, 0x00 }, // Frame 7
|
||||||
|
{ 0x79, 0x00, 0x00, 0x78 }, // Frame 8
|
||||||
|
{ 0x00, 0x00, 0x78, 0x5c }, // Frame 9
|
||||||
|
{ 0x00, 0x78, 0x5c, 0x00 }, // Frame 10
|
||||||
|
{ 0x78, 0x5c, 0x00, 0x00 }, // Frame 11
|
||||||
|
{ 0x5c, 0x00, 0x00, 0x78 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x78, 0x74 }, // Frame 13
|
||||||
|
{ 0x00, 0x78, 0x74, 0x48 }, // Frame 14
|
||||||
|
{ 0x78, 0x74, 0x48, 0x00 }, // Frame 15
|
||||||
|
{ 0x74, 0x48, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x48, 0x00, 0x00, 0x71 }, // Frame 17
|
||||||
|
{ 0x00, 0x00, 0x71, 0x1c }, // Frame 18
|
||||||
|
{ 0x00, 0x71, 0x1c, 0x78 }, // Frame 19
|
||||||
|
{ 0x71, 0x1c, 0x78, 0x1c }, // Frame 20
|
||||||
|
{ 0x1c, 0x78, 0x1c, 0x50 }, // Frame 21
|
||||||
|
{ 0x78, 0x1c, 0x50, 0x48 }, // Frame 22
|
||||||
|
{ 0x1c, 0x50, 0x48, 0x82 }, // Frame 23
|
||||||
|
{ 0x50, 0x48, 0x82, 0x00 }, // Frame 24
|
||||||
|
{ 0x48, 0x82, 0x00, 0x00 }, // Frame 25
|
||||||
|
{ 0x82, 0x00, 0x00, 0x00 } // Frame 26
|
||||||
|
};
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
Macro Board
|
||||||
|
Made by Bozarre
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* saving presets in eeprom
|
||||||
|
*/
|
||||||
|
#include <EEPROM.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 7 Segment 4 digits display
|
||||||
|
*/
|
||||||
|
#include "SevSeg.h"
|
||||||
|
SevSeg sevseg;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* key button matrix
|
||||||
|
*/
|
||||||
|
#include <Key.h>
|
||||||
|
#include <Keypad.h>
|
||||||
|
|
||||||
|
const byte rows = 4; //four rows
|
||||||
|
const byte cols = 3; //three columns
|
||||||
|
char keys[rows][cols] = { // assiging arbitraty uid to each button
|
||||||
|
{1,5,9},
|
||||||
|
{2,6,10},
|
||||||
|
{3,7,11},
|
||||||
|
{4,8,12}
|
||||||
|
};
|
||||||
|
byte rowPins[rows] = {1, 2, 3, 0}; //connect to the row pinouts of the keypad
|
||||||
|
byte colPins[cols] = {21, 22, 23}; //connect to the column pinouts of the keypad
|
||||||
|
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rotary Encoder
|
||||||
|
*/
|
||||||
|
#include <SimpleRotary.h>
|
||||||
|
|
||||||
|
SimpleRotary rotaryEncoder(19, 20, 4);
|
||||||
|
byte rotaryEncoderState = 0;
|
||||||
|
|
||||||
|
// Rotary push button
|
||||||
|
const int BUTTON_Rotary = 4;
|
||||||
|
bool BUTTON_Rotary_lastState = HIGH;
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include <Key.h>
|
||||||
|
#include <Keypad.h>
|
||||||
|
|
||||||
|
const byte rows = 4; //four rows
|
||||||
|
const byte cols = 3; //three columns
|
||||||
|
char keys[rows][cols] = {
|
||||||
|
{'1','5','9'},
|
||||||
|
{'2','6','x'},
|
||||||
|
{'3','7','y'},
|
||||||
|
{'4','8','z'}
|
||||||
|
};
|
||||||
|
byte rowPins[rows] = {1, 2, 3, 0}; //connect to the row pinouts of the keypad
|
||||||
|
byte colPins[cols] = {21, 22, 23}; //connect to the column pinouts of the keypad
|
||||||
|
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
char customKey = keypad.getKey();
|
||||||
|
|
||||||
|
if (customKey){
|
||||||
|
Serial.println(customKey);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,246 @@
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION1[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x01 }, // Frame 1
|
||||||
|
{ 0x00, 0x00, 0x01, 0x00 }, // Frame 2
|
||||||
|
{ 0x00, 0x01, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x01, 0x00, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x20, 0x00, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x10, 0x00, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 7
|
||||||
|
{ 0x00, 0x08, 0x00, 0x00 }, // Frame 8
|
||||||
|
{ 0x00, 0x00, 0x08, 0x00 }, // Frame 9
|
||||||
|
{ 0x00, 0x00, 0x00, 0x08 }, // Frame 10
|
||||||
|
{ 0x00, 0x00, 0x00, 0x04 }, // Frame 11
|
||||||
|
{ 0x00, 0x00, 0x00, 0x02 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x01, 0x01 }, // Frame 13
|
||||||
|
{ 0x01, 0x01, 0x00, 0x00 }, // Frame 14
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 15
|
||||||
|
{ 0x08, 0x08, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x00, 0x00, 0x08, 0x08 }, // Frame 17
|
||||||
|
{ 0x00, 0x00, 0x00, 0x06 }, // Frame 18
|
||||||
|
{ 0x00, 0x01, 0x01, 0x01 }, // Frame 19
|
||||||
|
{ 0x31, 0x00, 0x00, 0x00 }, // Frame 20
|
||||||
|
{ 0x08, 0x08, 0x08, 0x00 }, // Frame 21
|
||||||
|
{ 0x00, 0x00, 0x00, 0x0e }, // Frame 22
|
||||||
|
{ 0x01, 0x01, 0x01, 0x01 }, // Frame 23
|
||||||
|
{ 0x38, 0x08, 0x00, 0x00 }, // Frame 24
|
||||||
|
{ 0x00, 0x00, 0x08, 0x0e }, // Frame 25
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 26
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 27
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff }, // Frame 28
|
||||||
|
{ 0x9b, 0x9b, 0x9b, 0x9b } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION2[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x48, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x49, 0x00, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x49, 0x08, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x49, 0x48, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x49, 0x49, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x49, 0x49, 0x08, 0x00 }, // Frame 7
|
||||||
|
{ 0x49, 0x49, 0x48, 0x00 }, // Frame 8
|
||||||
|
{ 0x49, 0x49, 0x49, 0x00 }, // Frame 9
|
||||||
|
{ 0x49, 0x49, 0x49, 0x08 }, // Frame 10
|
||||||
|
{ 0x49, 0x49, 0x49, 0x48 }, // Frame 11
|
||||||
|
{ 0x49, 0x49, 0x49, 0x49 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 13
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 14
|
||||||
|
{ 0x5c, 0x00, 0x00, 0x00 }, // Frame 15
|
||||||
|
{ 0x7f, 0x00, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x7f, 0x08, 0x00, 0x00 }, // Frame 17
|
||||||
|
{ 0x7f, 0x5c, 0x00, 0x00 }, // Frame 18
|
||||||
|
{ 0x7f, 0x7f, 0x00, 0x00 }, // Frame 19
|
||||||
|
{ 0x7f, 0x7f, 0x08, 0x00 }, // Frame 20
|
||||||
|
{ 0x7f, 0x7f, 0x5c, 0x00 }, // Frame 21
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x00 }, // Frame 22
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x08 }, // Frame 23
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x5c }, // Frame 24
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f }, // Frame 25
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 26
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 27
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION3[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x08, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x08, 0x00, 0x08, 0x00 }, // Frame 2
|
||||||
|
{ 0x08, 0x00, 0x08, 0x08 }, // Frame 3
|
||||||
|
{ 0x48, 0x08, 0x08, 0x08 }, // Frame 4
|
||||||
|
{ 0x48, 0x08, 0x48, 0x08 }, // Frame 5
|
||||||
|
{ 0x08, 0x08, 0x49, 0x49 }, // Frame 6
|
||||||
|
{ 0x08, 0x48, 0x48, 0x49 }, // Frame 7
|
||||||
|
{ 0x08, 0x48, 0x08, 0x49 }, // Frame 8
|
||||||
|
{ 0x08, 0x08, 0x08, 0x48 }, // Frame 9
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 10
|
||||||
|
{ 0x49, 0x08, 0x48, 0x48 }, // Frame 11
|
||||||
|
{ 0x49, 0x08, 0x49, 0x08 }, // Frame 12
|
||||||
|
{ 0x49, 0x08, 0x08, 0x08 }, // Frame 13
|
||||||
|
{ 0x48, 0x08, 0x08, 0x08 }, // Frame 14
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 15
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 16
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 17
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 18
|
||||||
|
{ 0x48, 0x48, 0x48, 0x48 }, // Frame 19
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 20
|
||||||
|
{ 0x08, 0x49, 0x49, 0x08 }, // Frame 21
|
||||||
|
{ 0x08, 0x48, 0x48, 0x08 }, // Frame 22
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 23
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 24
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 25
|
||||||
|
{ 0x48, 0x08, 0x08, 0x48 }, // Frame 26
|
||||||
|
{ 0x08, 0x08, 0x08, 0x08 }, // Frame 27
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION4[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 1
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 2
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 3
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 4
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 5
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 6
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 7
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 8
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 9
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 10
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 11
|
||||||
|
{ 0x63, 0x08, 0x08, 0x63 }, // Frame 12
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 13
|
||||||
|
{ 0x63, 0x58, 0x4c, 0x63 }, // Frame 14
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 15
|
||||||
|
{ 0x63, 0x39, 0x0f, 0x63 }, // Frame 16
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 17
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 18
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 19
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 20
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 21
|
||||||
|
{ 0x62, 0x58, 0x4c, 0x62 }, // Frame 22
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 23
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 24
|
||||||
|
{ 0x62, 0x39, 0x0f, 0x62 }, // Frame 25
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 27
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 }, // Frame 28
|
||||||
|
{ 0x62, 0x08, 0x08, 0x62 } // Frame 29
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION5[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 3
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 4
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 5
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 6
|
||||||
|
{ 0x76, 0x00, 0x00, 0x06 }, // Frame 7
|
||||||
|
{ 0x70, 0x40, 0x00, 0x06 }, // Frame 8
|
||||||
|
{ 0x70, 0x00, 0x40, 0x06 }, // Frame 9
|
||||||
|
{ 0x70, 0x00, 0x00, 0x46 }, // Frame 10
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 11
|
||||||
|
{ 0x70, 0x00, 0x00, 0x46 }, // Frame 12
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 13
|
||||||
|
{ 0x70, 0x00, 0x00, 0x06 }, // Frame 14
|
||||||
|
{ 0x70, 0x00, 0x00, 0x0c }, // Frame 15
|
||||||
|
{ 0x70, 0x00, 0x00, 0x0c }, // Frame 16
|
||||||
|
{ 0x70, 0x00, 0x00, 0x88 }, // Frame 17
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 18
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 19
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 20
|
||||||
|
{ 0x30, 0x00, 0x00, 0x88 }, // Frame 21
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 22
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 23
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 24
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 25
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 }, // Frame 26
|
||||||
|
{ 0x00, 0x00, 0x00, 0x88 } // Frame 27
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION6[41][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 1
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 2
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 3
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 4
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 5
|
||||||
|
{ 0x30, 0x00, 0x00, 0x00 }, // Frame 6
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 7
|
||||||
|
{ 0x30, 0x00, 0x00, 0x06 }, // Frame 8
|
||||||
|
{ 0x06, 0x00, 0x00, 0x06 }, // Frame 9
|
||||||
|
{ 0x06, 0x00, 0x00, 0x30 }, // Frame 10
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 11
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 12
|
||||||
|
{ 0x00, 0x50, 0x06, 0x00 }, // Frame 13
|
||||||
|
{ 0x00, 0x50, 0x44, 0x00 }, // Frame 14
|
||||||
|
{ 0x00, 0x50, 0x44, 0x00 }, // Frame 15
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 16
|
||||||
|
{ 0x00, 0x30, 0x06, 0x00 }, // Frame 17
|
||||||
|
{ 0x00, 0x70, 0x06, 0x00 }, // Frame 18
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 19
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 20
|
||||||
|
{ 0x00, 0x06, 0x46, 0x70 }, // Frame 21
|
||||||
|
{ 0x00, 0x06, 0x46, 0x46 }, // Frame 22
|
||||||
|
{ 0x00, 0x06, 0x46, 0x50 }, // Frame 23
|
||||||
|
{ 0x00, 0x06, 0x46, 0x40 }, // Frame 24
|
||||||
|
{ 0x00, 0x06, 0x46, 0x00 }, // Frame 25
|
||||||
|
{ 0x00, 0x06, 0x06, 0x00 }, // Frame 26
|
||||||
|
{ 0x00, 0x06, 0x06, 0x00 }, // Frame 27
|
||||||
|
{ 0x00, 0x06, 0x0c, 0x00 }, // Frame 28
|
||||||
|
{ 0x00, 0x06, 0x0c, 0x00 }, // Frame 29
|
||||||
|
{ 0x00, 0x06, 0x88, 0x00 }, // Frame 30
|
||||||
|
{ 0x00, 0x06, 0x88, 0x00 }, // Frame 31
|
||||||
|
{ 0x00, 0x30, 0x88, 0x00 }, // Frame 32
|
||||||
|
{ 0x00, 0x30, 0x88, 0x00 }, // Frame 33
|
||||||
|
{ 0x06, 0x00, 0x88, 0x00 }, // Frame 34
|
||||||
|
{ 0x06, 0x00, 0x88, 0x00 }, // Frame 35
|
||||||
|
{ 0x30, 0x00, 0x88, 0x00 }, // Frame 36
|
||||||
|
{ 0x30, 0x00, 0x88, 0x00 }, // Frame 37
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 }, // Frame 38
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 }, // Frame 39
|
||||||
|
{ 0x00, 0x00, 0x88, 0x00 } // Frame 40
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Animation Data - HGFEDCBA Map */
|
||||||
|
const uint8_t ANIMATION7[30][4] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x3c }, // Frame 0
|
||||||
|
{ 0x00, 0x00, 0x3c, 0x1e }, // Frame 0
|
||||||
|
{ 0x00, 0x3c, 0x1e, 0x79 }, // Frame 0
|
||||||
|
{ 0x3c, 0x1e, 0x79, 0x38 }, // Frame 1
|
||||||
|
{ 0x1e, 0x79, 0x38, 0x39 }, // Frame 2
|
||||||
|
{ 0x79, 0x38, 0x39, 0x3f }, // Frame 3
|
||||||
|
{ 0x38, 0x39, 0x3f, 0x37 }, // Frame 4
|
||||||
|
{ 0x39, 0x3f, 0x37, 0x79 }, // Frame 5
|
||||||
|
{ 0x3f, 0x37, 0x79, 0x00 }, // Frame 6
|
||||||
|
{ 0x37, 0x79, 0x00, 0x00 }, // Frame 7
|
||||||
|
{ 0x79, 0x00, 0x00, 0x78 }, // Frame 8
|
||||||
|
{ 0x00, 0x00, 0x78, 0x5c }, // Frame 9
|
||||||
|
{ 0x00, 0x78, 0x5c, 0x00 }, // Frame 10
|
||||||
|
{ 0x78, 0x5c, 0x00, 0x00 }, // Frame 11
|
||||||
|
{ 0x5c, 0x00, 0x00, 0x78 }, // Frame 12
|
||||||
|
{ 0x00, 0x00, 0x78, 0x74 }, // Frame 13
|
||||||
|
{ 0x00, 0x78, 0x74, 0x48 }, // Frame 14
|
||||||
|
{ 0x78, 0x74, 0x48, 0x00 }, // Frame 15
|
||||||
|
{ 0x74, 0x48, 0x00, 0x00 }, // Frame 16
|
||||||
|
{ 0x48, 0x00, 0x00, 0x71 }, // Frame 17
|
||||||
|
{ 0x00, 0x00, 0x71, 0x1c }, // Frame 18
|
||||||
|
{ 0x00, 0x71, 0x1c, 0x78 }, // Frame 19
|
||||||
|
{ 0x71, 0x1c, 0x78, 0x1c }, // Frame 20
|
||||||
|
{ 0x1c, 0x78, 0x1c, 0x50 }, // Frame 21
|
||||||
|
{ 0x78, 0x1c, 0x50, 0x48 }, // Frame 22
|
||||||
|
{ 0x1c, 0x50, 0x48, 0x82 }, // Frame 23
|
||||||
|
{ 0x50, 0x48, 0x82, 0x00 }, // Frame 24
|
||||||
|
{ 0x48, 0x82, 0x00, 0x00 }, // Frame 25
|
||||||
|
{ 0x82, 0x00, 0x00, 0x00 } // Frame 26
|
||||||
|
};
|
|
@ -0,0 +1,210 @@
|
||||||
|
#include <Keyboard.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "SevSeg.h"
|
||||||
|
SevSeg sevseg;
|
||||||
|
|
||||||
|
|
||||||
|
#include <Key.h>
|
||||||
|
#include <Keypad.h>
|
||||||
|
|
||||||
|
const byte rows = 4; //four rows
|
||||||
|
const byte cols = 3; //three columns
|
||||||
|
char keys[rows][cols] = {
|
||||||
|
{1,5,9},
|
||||||
|
{2,6,10},
|
||||||
|
{3,7,11},
|
||||||
|
{4,8,12}
|
||||||
|
};
|
||||||
|
byte rowPins[rows] = {1, 2, 3, 0}; //connect to the row pinouts of the keypad
|
||||||
|
byte colPins[cols] = {21, 22, 23}; //connect to the column pinouts of the keypad
|
||||||
|
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
|
||||||
|
|
||||||
|
|
||||||
|
#include <SimpleRotary.h>
|
||||||
|
|
||||||
|
SimpleRotary rotaryEncoder(19, 20, 4);
|
||||||
|
byte rotaryEncoderState = 0;
|
||||||
|
|
||||||
|
// BUTTONS Rotary
|
||||||
|
const int BUTTON_Rotary = 4;
|
||||||
|
bool BUTTON_Rotary_lastState = HIGH;
|
||||||
|
|
||||||
|
#include "animations.h"
|
||||||
|
|
||||||
|
// Variables globales
|
||||||
|
int frameId = 0; // début
|
||||||
|
int frameAnim = 0; // début
|
||||||
|
int animId = 0; // début
|
||||||
|
int loopFrames = 20000;
|
||||||
|
|
||||||
|
|
||||||
|
int waitDelay = 0;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
byte numDigits = 4;
|
||||||
|
byte digitPins[] = {7, 8, 9, 6};
|
||||||
|
byte segmentPins[] = {10, 12, 14, 16, 17, 11, 13, 15};
|
||||||
|
|
||||||
|
bool resistorsOnSegments = true;
|
||||||
|
bool updateWithDelaysIn = true;
|
||||||
|
byte hardwareConfig = COMMON_CATHODE;
|
||||||
|
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments);
|
||||||
|
sevseg.setBrightness(90);
|
||||||
|
|
||||||
|
//Init rotary encoders
|
||||||
|
rotaryEncoder.setDebounceDelay(2);
|
||||||
|
rotaryEncoder.setErrorDelay(100);
|
||||||
|
|
||||||
|
pinMode(BUTTON_Rotary, INPUT_PULLUP);
|
||||||
|
|
||||||
|
Serial.begin(9600);
|
||||||
|
Serial.println("setup");
|
||||||
|
|
||||||
|
Keyboard.begin();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
sevseg.refreshDisplay();
|
||||||
|
//sevseg.setNumber(1234, 1);
|
||||||
|
//sevseg.setNumber(frameAnim, 2);
|
||||||
|
// système pour augmenter le compteur et créer un système de vitesse
|
||||||
|
|
||||||
|
char customKey = keypad.getKey();
|
||||||
|
|
||||||
|
rotaryEncoderState = rotaryEncoder.rotate();
|
||||||
|
|
||||||
|
if (waitDelay > 0)
|
||||||
|
{
|
||||||
|
waitDelay -= 1;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (customKey){
|
||||||
|
Serial.println(customKey);
|
||||||
|
if (customKey == 1)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(1, -1);
|
||||||
|
Keyboard.press(KEY_F13);
|
||||||
|
Keyboard.release(KEY_F13);
|
||||||
|
}
|
||||||
|
if (customKey == 2)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(2, -1);
|
||||||
|
Keyboard.press(KEY_F14);
|
||||||
|
Keyboard.release(KEY_F14);
|
||||||
|
}
|
||||||
|
if (customKey == 3)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(3, -1);
|
||||||
|
Keyboard.press(KEY_F15);
|
||||||
|
Keyboard.release(KEY_F15);
|
||||||
|
}
|
||||||
|
if (customKey == 4)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(4, -1);
|
||||||
|
Keyboard.press(KEY_F16);
|
||||||
|
Keyboard.release(KEY_F16);
|
||||||
|
}
|
||||||
|
if (customKey == 5)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(5, -1);
|
||||||
|
Keyboard.press(KEY_F17);
|
||||||
|
Keyboard.release(KEY_F17);
|
||||||
|
}
|
||||||
|
if (customKey == 6)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(6, -1);
|
||||||
|
Keyboard.press(KEY_F18);
|
||||||
|
Keyboard.release(KEY_F18);
|
||||||
|
}
|
||||||
|
if (customKey == 7)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(7, -1);
|
||||||
|
Keyboard.press(KEY_F19);
|
||||||
|
Keyboard.release(KEY_F19);
|
||||||
|
}
|
||||||
|
if (customKey == 8)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(8, -1);
|
||||||
|
Keyboard.press(KEY_F20);
|
||||||
|
Keyboard.release(KEY_F20);
|
||||||
|
}
|
||||||
|
if (customKey == 9)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(9, -1);
|
||||||
|
Keyboard.press(KEY_F21);
|
||||||
|
Keyboard.release(KEY_F21);
|
||||||
|
}
|
||||||
|
if (customKey == 10)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(10, -1);
|
||||||
|
Keyboard.press(KEY_F22);
|
||||||
|
Keyboard.release(KEY_F22);
|
||||||
|
}
|
||||||
|
if (customKey == 11)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(11, -1);
|
||||||
|
Keyboard.press(KEY_F23);
|
||||||
|
Keyboard.release(KEY_F23);
|
||||||
|
}
|
||||||
|
if (customKey == 12)
|
||||||
|
{
|
||||||
|
sevseg.setNumber(12, -1);
|
||||||
|
Keyboard.press(KEY_F24);
|
||||||
|
Keyboard.release(KEY_F24);
|
||||||
|
}
|
||||||
|
waitDelay = 5000;
|
||||||
|
} else if (digitalRead(BUTTON_Rotary) == LOW && BUTTON_Rotary_lastState == HIGH) // = pressed
|
||||||
|
{
|
||||||
|
sevseg.setNumber(13, -1);
|
||||||
|
Keyboard.press(KEY_MEDIA_MUTE);
|
||||||
|
Keyboard.release(KEY_MEDIA_MUTE);
|
||||||
|
waitDelay = 5000;
|
||||||
|
} else if (rotaryEncoderState == 1 || rotaryEncoderState == 2)
|
||||||
|
{
|
||||||
|
if ( rotaryEncoderState == 1 ) //Turned Clockwise
|
||||||
|
{
|
||||||
|
sevseg.setNumber(14, -1);
|
||||||
|
Keyboard.press(KEY_MEDIA_VOLUME_INC);
|
||||||
|
Keyboard.release(KEY_MEDIA_VOLUME_INC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( rotaryEncoderState == 2 ) //Turned Counter-Clockwise
|
||||||
|
{
|
||||||
|
sevseg.setNumber(15, -1);
|
||||||
|
Keyboard.press(KEY_MEDIA_VOLUME_DEC);
|
||||||
|
Keyboard.release(KEY_MEDIA_VOLUME_DEC);
|
||||||
|
}
|
||||||
|
waitDelay = 5000;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
|
||||||
|
frameId ++;
|
||||||
|
|
||||||
|
if (frameId >= loopFrames)
|
||||||
|
{
|
||||||
|
frameAnim++;
|
||||||
|
frameId = 0;
|
||||||
|
}
|
||||||
|
if (frameAnim == 30)
|
||||||
|
{
|
||||||
|
animId = (animId + 1)%7;
|
||||||
|
frameAnim = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(animId == 0) sevseg.setSegments(ANIMATION1[frameAnim]);
|
||||||
|
if(animId == 1) sevseg.setSegments(ANIMATION2[frameAnim]);
|
||||||
|
if(animId == 2) sevseg.setSegments(ANIMATION3[frameAnim]);
|
||||||
|
if(animId == 3) sevseg.setSegments(ANIMATION4[frameAnim]);
|
||||||
|
if(animId == 4) sevseg.setSegments(ANIMATION7[frameAnim]);
|
||||||
|
if(animId == 5) sevseg.setSegments(ANIMATION7[frameAnim]);
|
||||||
|
if(animId == 6) sevseg.setSegments(ANIMATION7[frameAnim]);
|
||||||
|
//delay(150);
|
||||||
|
}
|
||||||
|
|
||||||
|
BUTTON_Rotary_lastState = digitalRead(BUTTON_Rotary);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue