From e5798d8e916d6e7832d659dbd2d1e5674d75bdee Mon Sep 17 00:00:00 2001 From: dewdude Date: Sun, 29 Dec 2019 21:47:06 -0500 Subject: [PATCH] Version 0.1.1: Now with REMOTE CONTROL! --- README.md | 6 +++--- pma770.ino | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8bcede2..25865bd 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ Schematics and pictures up later. # History ``` -28-Dec-2019: Initial Version. Just reads five switches and triggers an -output. -29-Dec-2019: Added a display. Cleaned up code. Made a repository. +28-Dec-2019: Initial Version. Just reads five switches and triggers an output. +29-Dec-2019: Version 0.1 - Added a display. Cleaned up code. Made a repository. +29-Dec-2019: Version 0.1.1 - Added preliminary IR remote support ```` diff --git a/pma770.ino b/pma770.ino index 962548d..d02a93f 100644 --- a/pma770.ino +++ b/pma770.ino @@ -1,19 +1,24 @@ /* - PMA770Relay 0.1 + PMA770Relay 0.1.1 dewdude@gmail.com - 29-12-2019 */ #include #include +#include + int latchPin = 11; int clockPin = 9; int dataPin = 12; +int IRin = 7; int matrix = A0; byte out = 0; int mx = 0; +IRrecv remote(IRin); +decode_results ircode; LiquidCrystal_I2C lcd(0x27,16,2); @@ -71,7 +76,7 @@ void setPh1() { DontCrossTheStreams(); bitSet(out,3); - bitSet(out,1); + bitSet(out,0); updateShiftRegister(); lcd.setCursor(7, 1); lcd.print("PHONO-1 "); @@ -81,7 +86,7 @@ void setPh2() { DontCrossTheStreams(); bitSet(out,3); - bitSet(out,2); + bitSet(out,1); updateShiftRegister(); lcd.setCursor(7, 1); lcd.print("PHONO-2 "); @@ -92,6 +97,7 @@ void setup() pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); + remote.enableIRIn(); bitSet(out,5); lcd.init(); lcd.backlight(); @@ -112,5 +118,28 @@ int mx = analogRead(matrix); if (mx > 900 && mx < 950) setAUX(); if (mx > 1000) setTune(); if (mx > 820 && mx < 899) setPh1(); +if (remote.decode(&ircode)) { + switch(ircode.value){ + case 0xFF6897: + setTape2(); + break; + case 0xFF9867: + setTape1(); + break; + case 0xFFB04F: + setAUX(); + break; + case 0xFF30CF: + setTune(); + break; + case 0xFF18E7: + setPh1(); + break; + case 0xFF7A85: + setPh2(); + break; + } + remote.resume(); + } delay(200); }