|
|
|
@ -42,13 +42,14 @@ const char in4[] PROGMEM = "PHONO-1";
|
|
|
|
|
const char in5[] PROGMEM = "PHONO-2";
|
|
|
|
|
|
|
|
|
|
const char * const inputs[] PROGMEM ={in0,in1,in2,in3,in4,in5};
|
|
|
|
|
|
|
|
|
|
int latchPin = 11;
|
|
|
|
|
int clockPin = 9;
|
|
|
|
|
int dataPin = 12;
|
|
|
|
|
int IRin = 7;
|
|
|
|
|
int blanking = 5;
|
|
|
|
|
int matrix = A0;
|
|
|
|
|
// scl to pin 28
|
|
|
|
|
// sdl pin 27
|
|
|
|
|
int latchPin = 11; // 328 pin 17 - 595 pin 12
|
|
|
|
|
int clockPin = 9; // 15 - pin 11
|
|
|
|
|
int dataPin = 12; // 18 - 14
|
|
|
|
|
int IRin = 7; //13
|
|
|
|
|
int blanking = 5; // 11
|
|
|
|
|
int matrix = A1; // 23
|
|
|
|
|
byte eop = 0;
|
|
|
|
|
byte ex = 0;
|
|
|
|
|
byte ei = 0;
|
|
|
|
@ -67,28 +68,42 @@ void DontCrossTheStreams(byte op, byte x, byte i) // There's something
|
|
|
|
|
u8g2.sendBuffer(); // your body exploding
|
|
|
|
|
eop = op; ex = x; ei = i; // at the speed of light.
|
|
|
|
|
// Total protonic reversal. // That's bad.
|
|
|
|
|
//lastbreath();
|
|
|
|
|
}// Important safety tip, thanks Egon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void eeprominit() { // This checks the EEPROM to see if it's
|
|
|
|
|
// been initialized by the code before.
|
|
|
|
|
if (EEPROM.read(dt) == 'T') { // Check address 1023 for init flag "T"
|
|
|
|
|
if (EEPROM.read(dt) == 'F') { // Check address 1023 for init flag "T"
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
EEPROM.write(db, 16);
|
|
|
|
|
EEPROM.write(dx, 32);
|
|
|
|
|
EEPROM.write(di, 2);
|
|
|
|
|
EEPROM.write(dt, 'T');
|
|
|
|
|
EEPROM.write(dt, 'F');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lastbreath() { // The idea here is to throw a large capacitor on to the voltage rail
|
|
|
|
|
EEPROM.update(db, eop); // powering the Arduino; but keep it from powering anything else.
|
|
|
|
|
EEPROM.update(dx, ex); // Monitor the "other" 5V rail with pin 2 and trigger an interrupt
|
|
|
|
|
EEPROM.update(di, ei); // and rely on the caps charge to keep charge long enough to write.
|
|
|
|
|
EEPROM.write(db, eop); // powering the Arduino; but keep it from powering anything else.
|
|
|
|
|
EEPROM.write(dx, ex); // Monitor the "other" 5V rail with pin 2 and trigger an interrupt
|
|
|
|
|
EEPROM.write(di, ei); // and rely on the caps charge to keep charge long enough to write.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void annoyingtrick() {
|
|
|
|
|
u8g2.clearBuffer(); // it stopping instaneously
|
|
|
|
|
u8g2.drawStr(22,30,"RAVE"); // and every molecule in
|
|
|
|
|
u8g2.sendBuffer();
|
|
|
|
|
for (int b = 0; b <=20000; b++){
|
|
|
|
|
byte trick = 0;
|
|
|
|
|
trick = random(1,127);
|
|
|
|
|
digitalWrite(latchPin, LOW); // It would be bad.
|
|
|
|
|
shiftOut(dataPin, clockPin, LSBFIRST, trick); // What do you mean, bad?
|
|
|
|
|
digitalWrite(latchPin, HIGH);
|
|
|
|
|
delay(25);}
|
|
|
|
|
DontCrossTheStreams(16,32,2);
|
|
|
|
|
}
|
|
|
|
|
void setup()
|
|
|
|
|
{
|
|
|
|
|
pinMode(latchPin, OUTPUT);
|
|
|
|
@ -107,6 +122,8 @@ void setup()
|
|
|
|
|
DontCrossTheStreams(EEPROM.read(db),EEPROM.read(dx),EEPROM.read(di)); // Read settings stored in EEPROM.
|
|
|
|
|
digitalWrite(blanking,HIGH); // Now drives a logic inverter.
|
|
|
|
|
attachInterrupt (digitalPinToInterrupt(2), lastbreath, FALLING); // Write the values before your cap discharges!
|
|
|
|
|
attachInterrupt (digitalPinToInterrupt(2), lastbreath, CHANGE); // Write the values before your cap discharges!
|
|
|
|
|
attachInterrupt (digitalPinToInterrupt(2), lastbreath, LOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
@ -117,12 +134,13 @@ if (remote.decode(&ircode)) {
|
|
|
|
|
icode = ircode.value;
|
|
|
|
|
remote.resume();
|
|
|
|
|
}
|
|
|
|
|
// I don't know if it improves things, but I sure like how much smaller this section is.
|
|
|
|
|
if ((mx > 100 && mx < 200) || (icode == 0x97)) DontCrossTheStreams(64,10,0); // The code I originally used to figure out my
|
|
|
|
|
if ((mx > 500 && mx < 600) || (icode == 0x67)) DontCrossTheStreams(32,10,1); // remote codes returned 3 bytes in hex. I can't
|
|
|
|
|
if ((mx > 900 && mx < 950) || (icode == 0x4F)) DontCrossTheStreams(16,32,2); // remember what that code was, but I only need
|
|
|
|
|
if ((mx > 1000) || (icode == 0xCF)) DontCrossTheStreams(8,18,3); // the last bit with the remote I'm using.
|
|
|
|
|
if ((mx > 820 && mx < 899) || (icode == 0xE7)) DontCrossTheStreams(6,1,4); // I'm working on making the bare-bones utility I
|
|
|
|
|
if ((mx > 700 && mx < 800) || (icode == 0x85)) DontCrossTheStreams(5,1,5); // wrote a bit more user-friendly.
|
|
|
|
|
// I don't know if it improves things, but I sure like how much smaller this section is.
|
|
|
|
|
if ((mx > 850 && mx < 860) || (icode == 0x97)) DontCrossTheStreams(64,10,0); // The code I originally used to figure out my
|
|
|
|
|
if ((mx > 2 && mx < 5) || (icode == 0x67)) DontCrossTheStreams(32,10,1); // remote codes returned 3 bytes in hex. I can't
|
|
|
|
|
if ((mx > 45 && mx < 50) || (icode == 0x4F)) DontCrossTheStreams(16,32,2); // remember what that code was, but I only need
|
|
|
|
|
if ((mx > 950 && mx < 970) || (icode == 0xCF)) DontCrossTheStreams(8,18,3); // the last bit with the remote I'm using.
|
|
|
|
|
if ((mx > 22 && mx < 30) || (icode == 0xE7)) DontCrossTheStreams(6,1,4); // I'm working on making the bare-bones utility I
|
|
|
|
|
if ((mx > 990 && mx < 1010) || (icode == 0x85)) DontCrossTheStreams(5,1,5); // wrote a bit more user-friendly.
|
|
|
|
|
if (icode == 0xAD) annoyingtrick();
|
|
|
|
|
delay(200);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|