Compare commits
No commits in common. "d49ca41c838b04b7c13ce5e1718df7529576b64d" and "07e2bd50c9c922ac2a8c8065dd15500e453a10cc" have entirely different histories.
d49ca41c83
...
07e2bd50c9
|
@ -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
|
||||
};
|
231
Maybe/Maybe.ino
231
Maybe/Maybe.ino
|
@ -17,22 +17,9 @@ struct MemSlot
|
|||
|
||||
MemSlot memory[] = //128 bytes for the Teensy LC
|
||||
{
|
||||
{"alt", 1, 0}, //preset
|
||||
{"bt1", 2, 0}, //button mode (0 = default, 1 = toggle)
|
||||
{"bt2", 3, 0},
|
||||
{"bt3", 4, 0},
|
||||
{"bt4", 5, 0},
|
||||
{"bt5", 6, 0},
|
||||
{"bt6", 7, 0},
|
||||
{"bt7", 8, 0},
|
||||
{"bt8", 9, 0},
|
||||
{"bt9", 10, 0},
|
||||
{"bt10", 11, 0},
|
||||
{"bt11", 12, 0},
|
||||
{"bt12", 13, 0},
|
||||
{"effc", 14, 2},
|
||||
{"afps", 15, 24},
|
||||
{"clea", 0, 0}, // != 0 -> reset eeprom
|
||||
{"prst", 1, 0},
|
||||
{"p2_1", 2, 63},
|
||||
{"p2_2", 3, 63},
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,23 +37,11 @@ struct MenuItem
|
|||
|
||||
MenuItem menuEntries[] =
|
||||
{
|
||||
{"", true, "alt"},
|
||||
{"", false, "btn"},
|
||||
{"", true, "effc"},
|
||||
{"", true, "afps"},
|
||||
{"", true, "clea"},
|
||||
{"/btn", true, "bt1"},
|
||||
{"/btn", true, "bt2"},
|
||||
{"/btn", true, "bt3"},
|
||||
{"/btn", true, "bt4"},
|
||||
{"/btn", true, "bt5"},
|
||||
{"/btn", true, "bt6"},
|
||||
{"/btn", true, "bt7"},
|
||||
{"/btn", true, "bt8"},
|
||||
{"/btn", true, "bt9"},
|
||||
{"/btn", true, "bt10"},
|
||||
{"/btn", true, "bt11"},
|
||||
{"/btn", true, "bt12"},
|
||||
{"", true, "prst"},
|
||||
{"", false, "edit"},
|
||||
{"/edit", false, "p2"},
|
||||
{"/edit/p2", true, "p2_1"},
|
||||
{"/edit/p2", true, "p2_2"},
|
||||
};
|
||||
|
||||
String menuCurrentPath = "";
|
||||
|
@ -100,22 +75,6 @@ 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 );
|
||||
|
||||
bool buttonsVirtualState[] =
|
||||
{
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
};
|
||||
|
||||
/*
|
||||
* Rotary Encoder
|
||||
*/
|
||||
|
@ -141,8 +100,7 @@ int animationFrame = 0;
|
|||
bool animationPlaying = false;
|
||||
unsigned int animationLastFrameMillis = 0;
|
||||
unsigned int animationFrameDelayMillis = 64;
|
||||
bool animationIdle = false;
|
||||
bool animationEnabled = true;
|
||||
bool animationLooping = false;
|
||||
|
||||
/*
|
||||
* time cooldown managment
|
||||
|
@ -160,13 +118,32 @@ unsigned int sevSegCoolDown = 5000;
|
|||
Serial.begin(9600);
|
||||
Serial.println("setup start");
|
||||
|
||||
//memory
|
||||
initEepromMemory();
|
||||
//write eeprom first init
|
||||
byte memValue = EEPROM.read(0);
|
||||
if (memValue == 255) // cannot find settings, writes defualt ones
|
||||
{
|
||||
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
||||
{
|
||||
EEPROM.write(memory[i].address, memory[i].value);
|
||||
}
|
||||
EEPROM.write(0,1);
|
||||
}
|
||||
//read eeprom
|
||||
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
||||
{
|
||||
memory[i].value = EEPROM.read(memory[i].address);
|
||||
}
|
||||
|
||||
applyMemoryChange();
|
||||
//Init display
|
||||
byte numDigits = 4;
|
||||
byte digitPins[] = {7, 8, 9, 6};
|
||||
byte segmentPins[] = {10, 12, 14, 16, 17, 11, 13, 15};
|
||||
|
||||
//display
|
||||
initSevSegDisplay();
|
||||
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);
|
||||
|
@ -186,69 +163,31 @@ unsigned int sevSegCoolDown = 5000;
|
|||
|
||||
}
|
||||
|
||||
void initEepromMemory()
|
||||
{
|
||||
//write eeprom first init
|
||||
byte memValue = EEPROM.read(0);
|
||||
if (memValue > 0) // cannot find settings, writes default ones
|
||||
{
|
||||
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
||||
{
|
||||
EEPROM.write(memory[i].address, memory[i].value);
|
||||
}
|
||||
EEPROM.write(getMemorySlot("clea")->address,0);
|
||||
}
|
||||
//read eeprom
|
||||
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
||||
{
|
||||
memory[i].value = EEPROM.read(memory[i].address);
|
||||
}
|
||||
}
|
||||
|
||||
void initSevSegDisplay()
|
||||
{
|
||||
//Init display
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tick Loop
|
||||
*/
|
||||
void loop()
|
||||
{
|
||||
//animation draw tick
|
||||
if (animationIdle && !animationPlaying && animationEnabled && !isInMenu)
|
||||
if (animationPlaying && millis() > (animationLastFrameMillis + animationFrameDelayMillis))
|
||||
{
|
||||
playAnimation(4);
|
||||
}
|
||||
if (animationEnabled && animationPlaying && (millis() > (animationLastFrameMillis + animationFrameDelayMillis)))
|
||||
{
|
||||
drawAnimation();
|
||||
drawAnimation(animationLooping);
|
||||
animationLastFrameMillis = millis();
|
||||
}
|
||||
|
||||
|
||||
//INPUTS
|
||||
if (millis() > lastInputMillis + inputCoolDown)
|
||||
{
|
||||
char customKey = keypad.getKey(); //-1 because our array stars with 1 instead of 0
|
||||
char customKey = keypad.getKey();
|
||||
|
||||
if (customKey > 0)
|
||||
if (customKey)
|
||||
{
|
||||
sendInputOuput(customKey-1);
|
||||
sendInputOuput(customKey);
|
||||
}
|
||||
|
||||
if (rotaryEncoder.push() == 1) // = pressed
|
||||
{
|
||||
sendInputOuput(14);
|
||||
sendInputOuput(15);
|
||||
}
|
||||
|
||||
rotaryEncoderState = rotaryEncoder.rotate();
|
||||
|
@ -257,25 +196,20 @@ void loop()
|
|||
{
|
||||
if ( rotaryEncoderState == 1 ) //Turned Clockwise
|
||||
{
|
||||
sendInputOuput(13);
|
||||
sendInputOuput(14);
|
||||
}
|
||||
|
||||
if ( rotaryEncoderState == 2 ) //Turned Counter-Clockwise
|
||||
{
|
||||
sendInputOuput(12);
|
||||
sendInputOuput(13);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*//clear screen after no input delay
|
||||
//clear screen after no input delay
|
||||
if (millis() > lastInputMillis + sevSegCoolDown)
|
||||
{
|
||||
//sevseg.blank();
|
||||
}*/
|
||||
|
||||
if(!animationPlaying && !isInMenu)
|
||||
{
|
||||
drawCustomSegments();
|
||||
}
|
||||
|
||||
sevseg.refreshDisplay();
|
||||
|
@ -331,7 +265,6 @@ void menuBack()
|
|||
menuSelectionIndex = 0;
|
||||
menuCurrentPath = "";
|
||||
sevseg.blank();
|
||||
playAnimation(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -425,19 +358,11 @@ bool menuSetValue(String variableName, byte newValue)
|
|||
if (memorySlot != NULL)
|
||||
{
|
||||
memorySlot->value = newValue;
|
||||
applyMemoryChange();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void applyMemoryChange()
|
||||
{
|
||||
animationEnabled = (getMemorySlot("effc")->value > 0);
|
||||
animationFrameDelayMillis = 1000 / max(1, getMemorySlot("afps")->value);
|
||||
animationIdle = (getMemorySlot("effc")->value == 2);
|
||||
}
|
||||
|
||||
int menuGetSelectionIndexFromPath(String path)
|
||||
{
|
||||
int correspondingPathItemIndex = 0;
|
||||
|
@ -473,16 +398,6 @@ MemSlot* getMemorySlot(String memSlotName)
|
|||
|
||||
void sendInputOuput(int input)
|
||||
{
|
||||
//get current presetID
|
||||
int currentPreset = (getMemorySlot("alt")->value) % getPresetsCount();
|
||||
//Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix,
|
||||
Action actionToRun = getAction(currentPreset, input); //getting the virtual inputs from the modes array.
|
||||
//Inputs uids starts with 1, so input - 1 to get the index 0 of the array
|
||||
|
||||
String inputName = "bt";
|
||||
inputName += input +1;
|
||||
MemSlot* buttonInputMem = getMemorySlot(inputName);
|
||||
Serial.println(inputName);
|
||||
|
||||
if (isInMenu)
|
||||
{
|
||||
|
@ -490,31 +405,25 @@ void sendInputOuput(int input)
|
|||
}
|
||||
else
|
||||
{
|
||||
//sevseg.setNumber(input, -1);
|
||||
playAnimation(1);
|
||||
|
||||
//toggle mode
|
||||
if (buttonInputMem != NULL)
|
||||
{
|
||||
if (buttonInputMem->value == 1)
|
||||
{
|
||||
buttonsVirtualState[input] = !buttonsVirtualState[input];
|
||||
actionToRun = getAction(currentPreset + (int)!buttonsVirtualState[input], input); //Toggle mode sends the next preset's input if the troggle state is true
|
||||
}
|
||||
if (buttonInputMem->value == 0)
|
||||
{
|
||||
buttonsVirtualState[input] = false;
|
||||
}
|
||||
}
|
||||
|
||||
clickKey(actionToRun.keyID, actionToRun.keyModifierID);
|
||||
}
|
||||
|
||||
lastInputMillis = millis();
|
||||
|
||||
int numberOfModes = sizeof(modes)/(sizeof(Action)*15);
|
||||
|
||||
int currentMode = (getMemorySlot("prst")->value) % numberOfModes;
|
||||
//Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix,
|
||||
Action actionToRun = modes[currentMode][input-1]; //getting the virtual inputs from the modes array.
|
||||
//Inputs uids starts with 1, so input - 1 to get the index 0 of the array
|
||||
|
||||
if (actionToRun.keyID == -1) //menu input, input mapping can be changed in modeAction.h
|
||||
{
|
||||
if (isInMenu)
|
||||
{
|
||||
menuBack();
|
||||
//playAnimation(3);
|
||||
playAnimation(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -524,43 +433,42 @@ void sendInputOuput(int input)
|
|||
printMenu();
|
||||
}
|
||||
}
|
||||
else if (isInMenu && input == 12) //menu prev, hardcoded input :/
|
||||
else if (isInMenu && input == 13) //menu prev, hardcoded input
|
||||
{
|
||||
menuPrev();
|
||||
}
|
||||
else if (isInMenu && input == 13) //menu next, hardcoded input :/
|
||||
else if (isInMenu && input == 14) //menu next, hardcoded input
|
||||
{
|
||||
menuNext();
|
||||
}
|
||||
else if (isInMenu && input == 14) //menu enter, hardcoded input :/
|
||||
else if (isInMenu && input == 15) //menu enter, hardcoded input
|
||||
{
|
||||
menuEnter();
|
||||
}
|
||||
else
|
||||
{
|
||||
clickKey(actionToRun.keyID, actionToRun.keyModifierID);
|
||||
}
|
||||
|
||||
lastInputMillis = millis();
|
||||
}
|
||||
|
||||
void clickKey(int key, int modifier)
|
||||
{
|
||||
Serial.println(key);
|
||||
Keyboard.set_modifier(modifier);
|
||||
Keyboard.press(key);
|
||||
Keyboard.release(key);
|
||||
Keyboard.set_modifier(0);
|
||||
Keyboard.send_now(); //i think that helps to avoid key to stay active
|
||||
//Keyboard.send_now(); //can't remember what's that's for
|
||||
}
|
||||
|
||||
void playAnimation(int animID)
|
||||
{
|
||||
if (animationEnabled)
|
||||
{
|
||||
currentAnimationID = animID;
|
||||
animationFrame = 0;
|
||||
animationPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
void drawAnimation()
|
||||
void drawAnimation(bool looping)
|
||||
{
|
||||
int currentAnimationFrameTotal = animData[currentAnimationID].animationFrameCount;
|
||||
sevseg.setSegments(animData[currentAnimationID].animationPtr + (animationFrame * (sizeof(const uint8_t)*4)));
|
||||
|
@ -568,7 +476,7 @@ void drawAnimation()
|
|||
if (animationFrame == currentAnimationFrameTotal)
|
||||
{
|
||||
animationFrame = 0;
|
||||
if (!(animData[currentAnimationID].animationLooping))
|
||||
if (!looping)
|
||||
{
|
||||
animationPlaying = false;
|
||||
sevseg.blank();
|
||||
|
@ -579,16 +487,3 @@ void drawAnimation()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawCustomSegments()
|
||||
{
|
||||
uint8_t seg0 = (0b00001000 * buttonsVirtualState[0]) + (0b01000000 * buttonsVirtualState[4]) + (0b00000001 * buttonsVirtualState[8]);
|
||||
uint8_t seg1 = (0b00001000 * buttonsVirtualState[1]) + (0b01000000 * buttonsVirtualState[5]) + (0b00000001 * buttonsVirtualState[9]);
|
||||
uint8_t seg2 = (0b00001000 * buttonsVirtualState[2]) + (0b01000000 * buttonsVirtualState[6]) + (0b00000001 * buttonsVirtualState[10]);
|
||||
uint8_t seg3 = (0b00001000 * buttonsVirtualState[3]) + (0b01000000 * buttonsVirtualState[7]) + (0b00000001 * buttonsVirtualState[11]);
|
||||
|
||||
sevseg.setSegmentsDigit(0,seg0);
|
||||
sevseg.setSegmentsDigit(1,seg1);
|
||||
sevseg.setSegmentsDigit(2,seg2);
|
||||
sevseg.setSegmentsDigit(3,seg3);
|
||||
}
|
||||
|
|
|
@ -3,14 +3,13 @@ int currentAnimationID = 0;
|
|||
struct AnimationData
|
||||
{
|
||||
const uint8_t *animationPtr;
|
||||
const unsigned int animationFrameCount;
|
||||
const bool animationLooping;
|
||||
unsigned int animationFrameCount;
|
||||
};
|
||||
|
||||
//animations created using https://jasonacox.github.io/TM1637TinyDisplay/examples/7-segment-animator.html
|
||||
|
||||
/* Animation Data - HGFEDCBA Map */
|
||||
const uint8_t ANIMATION1[][4] = {
|
||||
const uint8_t ANIMATION1[31][4] = {
|
||||
{ 0x00, 0x00, 0x00, 0x01 }, // Frame 0
|
||||
{ 0x00, 0x00, 0x01, 0x00 }, // Frame 1
|
||||
{ 0x00, 0x01, 0x00, 0x00 }, // Frame 2
|
||||
|
@ -40,6 +39,8 @@ const uint8_t ANIMATION1[][4] = {
|
|||
{ 0x08, 0x08, 0x08, 0x0e }, // Frame 26
|
||||
{ 0x39, 0x09, 0x09, 0x0f }, // Frame 27
|
||||
{ 0x46, 0x76, 0x76, 0x70 }, // Frame 28
|
||||
{ 0x40, 0x40, 0x40, 0x40 }, // Frame 29
|
||||
{ 0x00, 0x40, 0x40, 0x00 } // Frame 30
|
||||
};
|
||||
|
||||
/* Animation Data - HGFEDCBA Map */
|
||||
|
@ -77,32 +78,12 @@ const uint8_t ANIMATION4[][4] = {
|
|||
{ 0x40, 0x40, 0x40, 0x40 }, // Frame 3
|
||||
{ 0x00, 0x40, 0x40, 0x00 }, // Frame 4
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 5
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 5
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // Frame 5
|
||||
};
|
||||
|
||||
/* Animation Data - HGFEDCBA Map */
|
||||
const uint8_t ANIMATION5[13][4] = {
|
||||
{ 0x39, 0x09, 0x09, 0x0f }, // Frame 0
|
||||
{ 0x39, 0x08, 0x09, 0x0f }, // Frame 1
|
||||
{ 0x38, 0x09, 0x09, 0x0f }, // Frame 2
|
||||
{ 0x19, 0x09, 0x09, 0x0f }, // Frame 3
|
||||
{ 0x29, 0x09, 0x09, 0x0f }, // Frame 4
|
||||
{ 0x31, 0x09, 0x09, 0x0f }, // Frame 5
|
||||
{ 0x39, 0x01, 0x09, 0x0f }, // Frame 6
|
||||
{ 0x39, 0x09, 0x01, 0x0f }, // Frame 7
|
||||
{ 0x39, 0x09, 0x09, 0x07 }, // Frame 8
|
||||
{ 0x39, 0x09, 0x09, 0x0b }, // Frame 9
|
||||
{ 0x39, 0x09, 0x09, 0x0d }, // Frame 10
|
||||
{ 0x39, 0x09, 0x09, 0x0e }, // Frame 11
|
||||
{ 0x39, 0x09, 0x08, 0x0f } // Frame 12
|
||||
};
|
||||
|
||||
AnimationData animData[] =
|
||||
{
|
||||
{(const uint8_t*)ANIMATION1, sizeof(ANIMATION1) / (sizeof(const uint8_t)*4), false},
|
||||
{(const uint8_t*)ANIMATION2, sizeof(ANIMATION2) / (sizeof(const uint8_t)*4), false},
|
||||
{(const uint8_t*)ANIMATION3, sizeof(ANIMATION3) / (sizeof(const uint8_t)*4), false},
|
||||
{(const uint8_t*)ANIMATION4, sizeof(ANIMATION4) / (sizeof(const uint8_t)*4), false},
|
||||
{(const uint8_t*)ANIMATION5, sizeof(ANIMATION5) / (sizeof(const uint8_t)*4), true}
|
||||
{(const uint8_t*)ANIMATION1, sizeof(ANIMATION1) / (sizeof(const uint8_t)*4)},
|
||||
{(const uint8_t*)ANIMATION2, sizeof(ANIMATION2) / (sizeof(const uint8_t)*4)},
|
||||
{(const uint8_t*)ANIMATION3, sizeof(ANIMATION3) / (sizeof(const uint8_t)*4)},
|
||||
{(const uint8_t*)ANIMATION4, sizeof(ANIMATION4) / (sizeof(const uint8_t)*4)}
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ struct Action
|
|||
};
|
||||
|
||||
//Hardware buttons and Actions are ordered from the bottom left to the top right matrix. Rotary encoder: left, right then press
|
||||
Action presets[][15] =
|
||||
Action modes[][15] =
|
||||
{
|
||||
{
|
||||
{KEY_MEDIA_PREV_TRACK, 0},
|
||||
|
@ -37,9 +37,9 @@ Action presets[][15] =
|
|||
{KEY_F22, MODIFIERKEY_SHIFT},
|
||||
{KEY_F23, MODIFIERKEY_SHIFT},
|
||||
{-1, 0}, //menu / back
|
||||
{KEYPAD_MINUS, MODIFIERKEY_ALT},
|
||||
{KEYPAD_PLUS, MODIFIERKEY_ALT},
|
||||
{KEYPAD_ASTERIX, MODIFIERKEY_ALT}
|
||||
{KEYPAD_MINUS, 0},
|
||||
{KEYPAD_PLUS, 0},
|
||||
{KEYPAD_ENTER, 0}
|
||||
},
|
||||
{
|
||||
{KEY_F13, MODIFIERKEY_CTRL},
|
||||
|
@ -56,17 +56,6 @@ Action presets[][15] =
|
|||
{-1, 0}, //menu / back
|
||||
{KEYPAD_MINUS, MODIFIERKEY_CTRL},
|
||||
{KEYPAD_PLUS, MODIFIERKEY_CTRL},
|
||||
{KEYPAD_ASTERIX, MODIFIERKEY_CTRL}
|
||||
{KEYPAD_ENTER, MODIFIERKEY_CTRL}
|
||||
}
|
||||
};
|
||||
|
||||
int getPresetsCount()
|
||||
{
|
||||
return sizeof(presets)/(sizeof(Action)*15);
|
||||
}
|
||||
|
||||
Action getAction(int presetID, int physicalKeyID)
|
||||
{
|
||||
int presetCount = getPresetsCount();
|
||||
return presets[(presetID % presetCount)][physicalKeyID];
|
||||
}
|
||||
|
|
26
Readme.md
26
Readme.md
|
@ -1,26 +0,0 @@
|
|||
# Maybe Arduino
|
||||
|
||||
This is the Arduino code for the teensy firmware used in the Maybe Macro Board
|
||||
|
||||
## Uploading the firmware using Teensyduino
|
||||
|
||||
- Install Teensyduino https://www.pjrc.com/teensy/td_download.html
|
||||
- Run Arduino .exe
|
||||
- Open Maybe.ino
|
||||
- In >> Tools/ setup the board settings:
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| Board | Teensy LC |
|
||||
| USB Type | Serial + Keyboard + Mouse + Joystick (but only Serial and Keyboard are used for now) |
|
||||
| CPU Speed | 48MHz (max) |
|
||||
| Optimize | Smallest Code |
|
||||
| Keyboard layout | US English (but any should work) |
|
||||
| Port | \[your teensy port |
|
||||
|
||||
- Upload
|
||||
|
||||
## License
|
||||
|
||||
Do What the Fuck You Want to Public License (WTFPL)
|
||||

|
|
@ -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 = 10000;
|
||||
} 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