This commit is contained in:
Tyler Perkins 2022-12-01 18:39:31 -05:00
parent 1eef32239f
commit ff4e4e7168
4 changed files with 108 additions and 17 deletions

20
remote/blink.ino.bak Normal file
View File

@ -0,0 +1,20 @@
///////////////////////////////////////////////////////////////////////////////
// Tyler Perkins
// 2-1-22
// Remote Entry point
//
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}

View File

@ -85,14 +85,14 @@
///////////////////////////////////////
// BUTTON 09
// VOL+
#define BUTTON09_PIN 8
#define BUTTON09_PIN 9
#define BUTTON09_ADDR 0x7080
#define BUTTON09_CMD 0xC7
///////////////////////////////////////
// BUTTON 10
// Power button
#define BUTTON10_PIN 9
#define BUTTON10_PIN 8
#define BUTTON10_ADDR 0x7484
#define BUTTON10_CMD 0xFF

View File

@ -17,6 +17,9 @@ void setup() {
//interrupt
pinMode(2, INPUT);
pinMode(3, OUTPUT);
irsend.begin(3);
//buttons
pinMode(BUTTON01_PIN, INPUT);
pinMode(BUTTON02_PIN, INPUT);
@ -29,38 +32,38 @@ void setup() {
pinMode(BUTTON09_PIN, INPUT);
pinMode(BUTTON10_PIN, INPUT);
irsend.begin(3, ENABLE_LED_FEEDBACK);
attachInterrupt(digitalPinToInterrupt(2),readInput, RISING);
}
void loop() {
attachInterrupt(digitalPinToInterrupt(2),readInput, RISING);
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
//LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
detachInterrupt(digitalPinToInterrupt(2));
attachInterrupt(digitalPinToInterrupt(2),readInput, RISING);
}
void readInput(){
if(digitalRead(BUTTON01_PIN) == HIGH){
irsend.sendNEC(BUTTON01_ADDR, BUTTON01_CMD, 1);
irsend.sendNEC(BUTTON01_ADDR, BUTTON01_CMD, 3);
} else if(digitalRead(BUTTON02_PIN) == HIGH){
irsend.sendNEC(BUTTON02_ADDR, BUTTON02_CMD, 1);
irsend.sendNEC(BUTTON02_ADDR, BUTTON02_CMD, 3);
} else if(digitalRead(BUTTON03_PIN) == HIGH){
irsend.sendNEC(BUTTON03_ADDR, BUTTON03_CMD, 1);
irsend.sendNEC(BUTTON03_ADDR, BUTTON03_CMD, 3);
} else if(digitalRead(BUTTON04_PIN) == HIGH){
irsend.sendNEC(BUTTON04_ADDR, BUTTON04_CMD, 1);
irsend.sendNEC(BUTTON04_ADDR, BUTTON04_CMD, 3);
} else if(digitalRead(BUTTON05_PIN) == HIGH){
irsend.sendNEC(BUTTON05_ADDR, BUTTON05_CMD, 1);
irsend.sendNEC(BUTTON05_ADDR, BUTTON05_CMD, 3);
} else if(digitalRead(BUTTON06_PIN) == HIGH){
irsend.sendNEC(BUTTON06_ADDR, BUTTON06_CMD, 1);
irsend.sendNEC(BUTTON06_ADDR, BUTTON06_CMD, 3);
} else if(digitalRead(BUTTON07_PIN) == HIGH){
irsend.sendNEC(BUTTON07_ADDR, BUTTON07_CMD, 1);
irsend.sendNEC(BUTTON07_ADDR, BUTTON07_CMD, 3);
} else if(digitalRead(BUTTON08_PIN) == HIGH){
irsend.sendNEC(BUTTON08_ADDR, BUTTON08_CMD, 1);
} else if(digitalRead(BUTTON09_PIN) == HIGH){
irsend.sendNEC(BUTTON09_ADDR, BUTTON09_CMD, 1);
irsend.sendNEC(BUTTON08_ADDR, BUTTON08_CMD, 3);
} else if(digitalRead(9) == HIGH){
irsend.sendNEC(0x7080, 0xC7, 3);
} else if(digitalRead(BUTTON10_PIN) == HIGH){
irsend.sendNEC(BUTTON10_ADDR, BUTTON10_CMD, 1);
irsend.sendNEC(BUTTON10_ADDR, BUTTON10_CMD, 10);
}
delay(25);

68
remote/remote.ino.bak Normal file
View File

@ -0,0 +1,68 @@
///////////////////////////////////////////////////////////////////////////////
// Tyler Perkins
// 2-1-22
// Remote Entry point
//
#include <IRremote.h>
#include "LowPower.h"
#include "config.h"
// IR library
IRsend irsend;
void setup() {
//set input pins
//interrupt
pinMode(2, INPUT);
//buttons
pinMode(BUTTON01_PIN, INPUT);
pinMode(BUTTON02_PIN, INPUT);
pinMode(BUTTON03_PIN, INPUT);
pinMode(BUTTON04_PIN, INPUT);
pinMode(BUTTON05_PIN, INPUT);
pinMode(BUTTON06_PIN, INPUT);
pinMode(BUTTON07_PIN, INPUT);
pinMode(BUTTON08_PIN, INPUT);
pinMode(BUTTON09_PIN, INPUT);
pinMode(BUTTON10_PIN, INPUT);
irsend.begin(3, ENABLE_LED_FEEDBACK);
attachInterrupt(digitalPinToInterrupt(2),readInput, RISING);
}
void loop() {
//attachInterrupt(digitalPinToInterrupt(2),readInput, RISING);
//LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
//detachInterrupt(digitalPinToInterrupt(2));
}
void readInput(){
if(digitalRead(BUTTON01_PIN) == HIGH){
irsend.sendNEC(BUTTON01_ADDR, BUTTON01_CMD, 3);
} else if(digitalRead(BUTTON02_PIN) == HIGH){
irsend.sendNEC(BUTTON02_ADDR, BUTTON02_CMD, 3);
} else if(digitalRead(BUTTON03_PIN) == HIGH){
irsend.sendNEC(BUTTON03_ADDR, BUTTON03_CMD, 3);
} else if(digitalRead(BUTTON04_PIN) == HIGH){
irsend.sendNEC(BUTTON04_ADDR, BUTTON04_CMD, 3);
} else if(digitalRead(BUTTON05_PIN) == HIGH){
irsend.sendNEC(BUTTON05_ADDR, BUTTON05_CMD, 3);
} else if(digitalRead(BUTTON06_PIN) == HIGH){
irsend.sendNEC(BUTTON06_ADDR, BUTTON06_CMD, 3);
} else if(digitalRead(BUTTON07_PIN) == HIGH){
irsend.sendNEC(BUTTON07_ADDR, BUTTON07_CMD, 3);
} else if(digitalRead(BUTTON08_PIN) == HIGH){
irsend.sendNEC(BUTTON08_ADDR, BUTTON08_CMD, 3);
} else if(digitalRead(BUTTON09_PIN) == HIGH){
irsend.sendNEC(BUTTON09_ADDR, BUTTON09_CMD, 3);
} else if(digitalRead(BUTTON10_PIN) == HIGH){
irsend.sendNEC(BUTTON10_ADDR, BUTTON10_CMD, 3);
}
delay(25);
}