tests
This commit is contained in:
parent
47914a7650
commit
d8e51001b3
|
@ -8,10 +8,25 @@
|
||||||
*/
|
*/
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
|
int address = 0;
|
||||||
|
byte value;
|
||||||
|
|
||||||
|
struct MemSlot
|
||||||
|
{
|
||||||
|
char* displayName;
|
||||||
|
int adress;
|
||||||
|
byte value;
|
||||||
|
};
|
||||||
|
|
||||||
|
MemSlot memory[3] = //128 bytes for the Teensy LC
|
||||||
|
{ {"test1", 0, 0}};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 7 Segment 4 digits display
|
* 7 Segment 4 digits display
|
||||||
*/
|
*/
|
||||||
#include "SevSeg.h"
|
#include "SevSeg.h"
|
||||||
|
|
||||||
SevSeg sevseg;
|
SevSeg sevseg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,3 +58,83 @@ byte rotaryEncoderState = 0;
|
||||||
// Rotary push button
|
// Rotary push button
|
||||||
const int BUTTON_Rotary = 4;
|
const int BUTTON_Rotary = 4;
|
||||||
bool BUTTON_Rotary_lastState = HIGH;
|
bool BUTTON_Rotary_lastState = HIGH;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* custom display animations
|
||||||
|
*/
|
||||||
|
#include "animations.h"
|
||||||
|
|
||||||
|
int animationFrame = 0;
|
||||||
|
bool animationLooping = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INIT
|
||||||
|
*/
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
//debug
|
||||||
|
Serial.begin(9600);
|
||||||
|
Serial.println("setup start");
|
||||||
|
|
||||||
|
//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);
|
||||||
|
|
||||||
|
//Init rotary encoders
|
||||||
|
rotaryEncoder.setDebounceDelay(2);
|
||||||
|
rotaryEncoder.setErrorDelay(100);
|
||||||
|
|
||||||
|
pinMode(BUTTON_Rotary, INPUT_PULLUP);
|
||||||
|
|
||||||
|
// Init keyboard output
|
||||||
|
Keyboard.begin();
|
||||||
|
|
||||||
|
Serial.println("setup complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tick Loop
|
||||||
|
*/
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
//INPUTS
|
||||||
|
char customKey = keypad.getKey();
|
||||||
|
|
||||||
|
rotaryEncoderState = rotaryEncoder.rotate();
|
||||||
|
|
||||||
|
//sevseg.refreshDisplay();
|
||||||
|
|
||||||
|
value = EEPROM.read(address);
|
||||||
|
|
||||||
|
Serial.print(address);
|
||||||
|
Serial.print("\t");
|
||||||
|
Serial.print(value, DEC);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
// advance to the next address of the EEPROM
|
||||||
|
address = address + 1;
|
||||||
|
|
||||||
|
// there are only 512 bytes of EEPROM, from 0 to 511, so if we're
|
||||||
|
// on address 512, wrap around to address 0
|
||||||
|
if (address == 128)
|
||||||
|
address = 0;
|
||||||
|
// Teensy 1.0 has 512 bytes
|
||||||
|
// Teensy 2.0 has 1024 bytes
|
||||||
|
// Teensy++ 1.0 has 2048 bytes
|
||||||
|
// Teensy++ 2.0 has 4096 bytes
|
||||||
|
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clickKey(int key)
|
||||||
|
{
|
||||||
|
Keyboard.press(key);
|
||||||
|
Keyboard.release(key);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue