Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make control with 2 pin output. #130

Open
gartner-dk opened this issue Nov 25, 2021 · 0 comments
Open

Make control with 2 pin output. #130

gartner-dk opened this issue Nov 25, 2021 · 0 comments

Comments

@gartner-dk
Copy link

gartner-dk commented Nov 25, 2021

Hi
Thanks for a great help with my project but I wish I had a diode that gave light so I could see what function I had activated I am a little new to it has so can not just see how to program myself out of so if you have activated eg 10 degrees then there is a diode that lights up in the button or next to it.
Hope someone can help me.

Have attached a picture the first model I have made without light.
and the code i use.

Yours sincerely
Mikael

Sluk = shut down

Code
#include <Arduino.h>
#include <HeatpumpIR.h> // https://github.com/ToniA/arduino-heatpumpir
#include <Button.h> // http://playground.arduino.cc/Code/Button

#define IR_HEADER_MARK 3500
#define IR_HEADER_SPACE 1800
#define IR_BIT_MARK 420
#define IR_ONE_SPACE 1350
#define IR_ZERO_SPACE 470
#define IR_PAUSE_SPACE 10000

// Heatpump states
const byte heatpumpOff = 0;
const byte heatpumpNormal = 1;
const byte heatpumpMaintenance = 2;

Button relay1 = Button(7, INPUT_PULLUP); // Heatpump ON 10
Button relay2 = Button(8, INPUT_PULLUP); // Heatpump ON 18
Button relay3 = Button(10, INPUT_PULLUP); // Heatpump ON 20
Button relay4 = Button(11, INPUT_PULLUP); // Heatpump ON 22
Button relay5 = Button(12, INPUT_PULLUP); // Heatpump OFF

IRSenderPWM irSender(9); // IR led on Duemilanove digital pin 9, using Arduino PWM

Remote
byte heatpumpState = heatpumpOff;

void sendRaw(char * symbols)
{
irSender.space(0);
irSender.setFrequency(38);

while (char symbol = *symbols++)
{
switch (symbol)
{
case '1':
irSender.space(IR_ONE_SPACE);
irSender.mark(IR_BIT_MARK);
break;
case '0':
irSender.space(IR_ZERO_SPACE);
irSender.mark(IR_BIT_MARK);
break;
case 'W':
irSender.space(IR_PAUSE_SPACE);
break;
case 'H':
irSender.mark(IR_HEADER_MARK);
break;
case 'h':
irSender.space(IR_HEADER_SPACE);
irSender.mark(IR_BIT_MARK);
break;
}
}

irSender.space(0);
}

void setup(){
Serial.begin(9600);
delay(500);
Serial.println(F("Starting..."));
}

void loop(){

if (relay1.isPressed()) {
// Heat 10

  Serial.println(F("* Sending normal heat 10"));
  sendRaw("Hh0100000000000100000001110010000000000000000000000000000001100000WHh01000000000001000000011100100000000000001001001000101000000000011000111000000000000000000111000000000111000000000000000010010001000000000000000011010011");

}
if (relay2.isPressed()) {
// Heat 18

  Serial.println(F("* Sending normal heat 18"));
  sendRaw("Hh0100000000000100000001110010000000000000000000000000000001100000WHh01000000000001000000011100100000000000001001001000100100000000011000010100000000000000000111000000000111000000000000000010010001000000000000000011010000");

}
if (relay3.isPressed()) {
// Heat 20

  Serial.println(F("* Sending normal heat 20"));
  sendRaw("Hh0100000000000100000001110010000000000000000000000000000001100000WHh01000000000001000000011100100000000000001001001000010100000000011000010101100000000000000111000000000111000000000000000010010001000000000000000010101000");

}
if (relay4.isPressed()) {
// Heat 22

  Serial.println(F("* Sending normal heat 22"));
  sendRaw("Hh0100000000000100000001110010000000000000000000000000000001100000WHh01000000000001000000011100100000000000001001001000110100000000011000010101100000000000000111000000000111000000000000000010010001000000000000000010011000");

}
if (relay5.isPressed()) {
// Heat OFF

  Serial.println(F("* Sending normal heat OFF"));
  sendRaw("Hh0100000000000100000001110010000000000000000000000000000001100000WHh01000000000001000000011100100000000000000001001000010100000000011000010100000000000000000111000000000111000000000000000010010001000000000000000001110000");


}

delay(500); // 0.5 seconds delay
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant