Ola pessoal estou tentando fazer uma automação com Arduino UNO R3 no meu AP e quando peguei os codigos do ar condicionado marca LG. achei os valores abaixo, o que ta acontecendo, eu consigo controlar de boa todos os comandos abaixo via serial monitor, usando o teclado do PC, mas não é o que eu quero! gostaria da ajuda de vcs para criar um comando via botão e não via serial é que não manjo de programação, ai se der para criar par um codigo eu faço o resto!
espero que possam me ajudar, tem muita gente com essa mesma duvida e gostaria tambem de ajuda-los caso de certo.
Código Fonte
#include <IRremote.h>
// Botao ligar, MODO AUTO, Temperatura 17, FAN AUTO
unsigned int on17[59] = {4150,4450,250,1850,300,550,550,1700,450,1700,400,600,500,550,500,1750,400,600,500,550,500,1700,450,600,500,500,550,1750,400,1750,400,550,500,1750,400,600,500,550,500,600,500,1700,450,1750,350,1750,400,1750,400,1750,400,1750,400,1750,400,1700,400,600,500,550,550,550,500,550,550,550,500,600,500,550,500,550,550,550,500,1700,450,600,450,600,500,550,550,1700,400,1750,400,1750,400,1750,400,550,500,1750,400,1750,400,1750,400,5350,4150,4500,250,1800,350,550,500,1800,350,1750,400,550,500,550,550,1750,400,600,450,600,500,1750,400,550,500,600,500,1750,350,1800,350,600,500,1650,500,550,550,500,550,550,500,1650,500,1650,500,1650,500,1600,550,1600,550,1600,550,1600,500,1650,500,550,550,500,550,550,550,500,550,550,550,500,550,550,550,500,550,550,550,1600,550,500,550,550,550,500,550,1600,550,1600,550,1600,550,1600,500,550,550,1600,550,1600,550,1600,550,};
// Botao ligar, MODO AUTO, Temperatura 18, FAN AUTO
unsigned int on18[59] = {4300,4300,550,1600,550,550,500,1650,500,1650,500,550,500,550,550,1650,500,500,550,550,550,1600,550,500,550,550,550,1600,500,1650,500,550,550,1600,550,500,550,550,550,500,550,1650,500,1650,500,1600,550,1600,550,1600,550,1600,500,1650,500,1650,500,550,500,550,550,550,500,550,550,550,550,500,550,550,500,550,550,1650,500,1600,550,500,550,550,550,550,500,1650,500,1650,500,1600,550,500,550,550,550,1600,500,1650,500,1650,550,5100,4300,4300,500,1600,550,550,500,1650,500,1650,500,550,550,550,500,1650,500,550,550,500,550,1650,500,550,500,550,550,1650,500,1600,550,500,550,1650,500,550,500,550,550,500,550,1650,500,1650,500,1650,500,1650,500,1600,550,1600,550,1600,500,1650,500,550,550,550,500,550,550,550,500,550,550,550,500,550,550,550,500,1650,500,1650,500,550,500,550,550,550,550,1600,500,1650,500,1650,500,550,500,550,550,1650,500,1600,550,1600,550,};
// Botao ligar, MODO AUTO, Temperatura 19, FAN AUTO
unsigned int on19[59] = {4300,4350,500,1600,550,550,550,1600,500,1650,500,550,550,550,500,1550,600,550,550,500,550,1600,550,550,500,550,550,1600,550,1550,600,550,500,1650,500,550,550,500,550,500,550,1650,500,1650,500,1600,550,1600,550,1600,550,1600,550,1600,500,1650,500,550,550,550,500,550,550,500,550,550,550,550,500,550,550,1600,550,1600,500,1650,500,600,500,550,500,600,500,1600,550,1600,500,600,500,550,550,500,550,1600,550,1600,550,1600,550,5100,4350,4250,550,1600,500,600,500,1600,550,1600,550,550,500,550,550,1600,500,600,500,550,500,1600,550,550,550,550,500,1650,500,1600,550,550,550,1600,500,550,550,550,500,600,500,1600,550,1600,550,1600,500,1600,550,1650,500,1600,550,1600,550,1600,550,550,500,550,550,550,500,550,550,550,500,550,550,550,500,1600,550,1600,550,1600,550,550,500,550,550,550,500,1650,500,1650,500,550,500,550,550,550,500,1650,500,1650,500,1650,500,};
// Botao ligar, MODO AUTO, Temperatura 20, FAN AUTO
unsigned int on20[59] = {4400,4250,550,1600,550,550,500,1600,550,1650,500,550,500,550,550,1600,550,550,500,550,550,1550,550,550,550,550,500,1650,500,1650,500,600,500,1600,550,500,550,550,550,550,500,1600,550,1600,550,1600,550,1600,500,1650,500,1600,550,1600,550,1600,550,550,500,550,550,550,500,550,550,550,550,500,550,550,500,1600,550,550,550,1600,550,500,550,550,550,550,500,1600,550,1650,500,550,500,1650,500,550,550,1600,500,1650,500,1600,600,5100,4300,4300,500,1600,550,550,550,1600,500,1650,500,550,550,550,500,1600,550,550,550,500,550,1600,550,550,500,550,550,1600,550,1600,550,500,550,1600,550,550,500,600,500,550,500,1600,550,1650,500,1600,550,1600,550,1600,550,1600,550,1600,500,1600,550,550,550,550,500,550,550,550,500,550,550,550,500,550,550,1600,550,500,550,1600,550,550,500,550,550,550,550,1600,500,1650,500,550,550,1600,550,550,500,1650,500,1650,500,1600,550,};
// Botao ligar, MODO AUTO, Temperatura 21, FAN AUTO
unsigned int on21[200] = {4300,4300,550,1600,550,550,500,1650,500,1650,500,550,500,550,550,1650,500,550,500,550,550,1650,500,550,500,550,550,1600,550,1600,500,550,550,1650,500,500,550,550,550,550,500,1650,500,1650,500,1650,500,1600,550,1600,550,1600,500,1650,500,1650,500,550,500,550,550,550,500,550,550,550,550,500,550,1650,500,1650,500,500,550,1650,500,550,550,550,500,550,550,1600,500,550,550,550,500,1650,500,550,550,1600,550,1600,550,1600,550,5100,4300,4250,550,1650,500,550,550,1600,550,1600,500,550,550,550,500,1650,500,550,550,550,500,1650,500,550,550,500,550,1650,500,1650,500,550,500,1650,500,550,550,550,500,550,550,1600,550,1600,500,1650,500,1650,500,1650,500,1650,500,1600,550,1600,500,550,550,550,500,550,550,550,500,550,550,550,500,1650,500,1650,500,550,550,1600,550,550,500,550,550,500,550,1650,500,550,500,550,550,1650,500,550,500,1650,500,1650,500,1650,500,};
// Botao Desligar
unsigned int off[59] = {4350,4250,600,1600,550,550,500,1650,500,1650,500,550,550,550,500,1650,500,550,550,550,550,1650,500,550,500,550,550,1650,500,1650,500,550,500,1650,550,500,550,1650,500,1650,500,1650,500,1650,500,550,550,1650,500,1650,500,1650,500,550,500,550,550,550,550,550,500,1650,500,550,550,550,550,1600,500,1650,500,1650,550,500,550,550,550,550,500,550,550,550,550,550,500,550,550,550,500,1650,500,1650,500,1650,500,1650,500,1650,550,5100,4350,4250,550,1650,500,550,550,1650,500,1600,550,550,550,550,500,1650,500,550,550,550,500,1650,500,550,550,550,550,1600,550,1550,600,500,550,1650,500,550,550,1600,550,1600,550,1600,550,1600,550,550,550,1600,550,1600,550,1600,550,550,500,550,550,550,500,550,550,1600,550,550,550,550,500,1650,500,1650,500,1650,500,550,550,550,500,550,550,550,500,600,500,550,550,550,500,550,550,1600,550,1600,550,1600,550,1600,550,1600,550,};
IRsend irsend;
void setup()
{
Serial.begin(9600);
}
void loop() {
if(Serial.available() > 0){
char valor = Serial.read();
if(valor == 'q'){
irsend.sendRaw(on17,59,32);
Serial.println("Liga - Temp: 17º");
}
if(valor == 'w'){
irsend.sendRaw(on18,59,32);
Serial.println("Liga - Temp: 18º");
}
if(valor == 'e'){
irsend.sendRaw(on19,59,32);
Serial.println("Liga - Temp: 19º");
}
if(valor == 'a'){
irsend.sendRaw(on20,200,38);
Serial.println("Liga - Temp: 20º");
}
if(valor == 's'){
irsend.sendRaw(on21,200,38);
Serial.println("Liga - Temp: 21º");
}
if(valor == 'd'){
irsend.sendRaw(off,59,32);
Serial.println("Desligando..");
}
}
}
Tags:
Onde ficaria esse botão no universo?
Pretendo colocar em um painel central onde controlo minhas TVs tudo dali, que quando apertado manda um sinal para o arduino.
os codigos da tv consigo controlar com essa estrutura abaixo, os botoes funcionam de boa, mas o ar condicionado os códigos não são em HEX, então não consigo encaixar o codigo dele nessa estrutura que esta abaixo que controlo apertando um botão e soltando!
#include <IRremote.h>
#include <IRremoteInt.h>
#include <IRremote.h> // Biblioteca para controlar o led infravermelho
IRsend irsend; //variável para poder enviar o código a TV
//variáveis constantes para o controle remoto
const int on = 9;
const int off = 10;
const int maisvol = 11;
const int menosvol = 12;
const int optical = 5;
const int vold = 7;
const int led = 8;
const int ledIR = 3;
//inicia o botão com o status 0
int buttonState = 0;
void setup() {
pinMode(led, OUTPUT); // saida led
pinMode(ledIR ,OUTPUT); // saída do infravermelho
Serial.begin(9600);
//configurando a entrada dos botoes
pinMode(on, INPUT);
pinMode(off, INPUT);
pinMode(maisvol, INPUT);
pinMode(menosvol, INPUT);
pinMode(optical, INPUT);
pinMode(off, INPUT);
}
void loop(){
//se o botão maisvolume for pressionado ele ira enviar o código para aumentar o volume na tv
if (digitalRead(on) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendSAMSUNG(0x34347887, 32);// código que sera enviado a tv para aumentar o volume
}
else {
digitalWrite(led, LOW);
}
//se o botão maisvolume for pressionado ele ira enviar o código para aumentar o volume na tv
if (digitalRead(off) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendSAMSUNG(0x34347887, 32);// código que sera enviado a tv para aumentar o volume
}
else {
digitalWrite(led, LOW);
}
//se o botão maisvolume for pressionado ele ira enviar o código para aumentar o volume na tv
if (digitalRead(maisvol) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendSAMSUNG(0x3434E817, 32);// código que sera enviado a tv para aumentar o volume
}
else {
digitalWrite(led, LOW);
}
//se o botão menosvolume for pressionado ele irá enviar o código para diminuir o volume na tv
if (digitalRead(menosvol) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendSAMSUNG(0x34346897, 32); // código que sera enviado a tv para diminuir o volume
}
else {
digitalWrite(led, LOW);
}
//se o botão maiscanal for pressionado ele ira enviar o código para aumentar o canal na tv
if (digitalRead(optical) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendNEC(0x34346D92, 32); // código que sera enviado a tv para aumentar o canal
}
else {
digitalWrite(led, LOW);
}
}
Estou fazendo meu TCC exatamente nisso... Assim que eu conseguir te mando.
Olá, Adriano... tem como assa
Não sei porq não foi toda a pergunta kkk
tem como passar seu email ou whats?
Obrigado
Bruno hoje testei o codigo abaixo do ar condicionado e foi de boa, não deu memoria cheia não. o primeiro exemplo que coloquei vi o cara que fez dizendo que o arduino nao tinha espaço, mas esse que coloquei por ultimo ta indo de boa.
Pessoal Consegui o que eu queria fazer, ficou assim.
#include <IRremote.h>
IRsend irsend;
const int ledIR = 3;
const int led = 8;
const int on = 9;
const int g18 = 10;
const int g22 = 11;
const int g25 = 12;
const int desl = 13;
// Botão liga Ar Condicionado
unsigned int rawDataon[59] = {3300,9500, 650,1350, 650,400, 650,350, 600,400, 600,1450, 600,400, 600,400, 600,450, 500,500, 500,550, 500,500, 500,500, 500,550, 450,550, 500,500, 500,500, 500,1550, 450,550, 500,1500, 500,550, 500,500, 500,500, 500,500, 550,500, 500,1500, 500,550, 500,1500, 500,500, 500}; //Aparelho foi Ligado
// Botão 18 Graus
unsigned int rawData18[59] = {3350,9400, 750,1300, 700,350, 650,350, 600,400, 600,1450, 600,400, 600,450, 550,450, 550,500, 500,500, 500,500, 500,500, 500,1550, 500,500, 500,500, 500,500, 550,500, 500,500, 500,1550, 450,1600, 450,550, 500,500, 500,500, 500,500, 550,1500, 500,500, 550,1500, 500,1500, 500}; //Aparelho esta em 18 Graus
// Botão 22 Graus
unsigned int rawData22[59] = {3400,9400, 700,1350, 650,350, 650,400, 600,400, 600,1400, 600,450, 550,450, 550,450, 550,500, 500,500, 500,500, 500,550, 500,1500, 500,500, 500,500, 550,500, 500,500, 500,1550, 500,1500, 550,1500, 500,550, 450,550, 450,550, 500,500, 500,1550, 500,1500, 500,1500, 550,1500, 500}; //Aparelho esta em 22 Graus
// Botão 25 Graus
unsigned int rawData25[59] = {3300,9450, 700,1350, 700,300, 650,400, 600,400, 600,1450, 600,450, 550,450, 550,450, 550,450, 550,500, 500,500, 500,500, 500,1550, 500,500, 500,500, 500,550, 500,1500, 500,550, 450,1550, 500,550, 450,550, 500,500, 500,500, 500,500, 550,500, 500,500, 500,1550, 500,500, 500}; //Aparelho esta em 25 Graus
// Botão Desliga Ar Condicionado
unsigned int off[200] = {3350,9400, 700,1350, 650,350, 650,350, 650,400, 600,1450, 550,450, 550,450, 600,450, 500,1550, 500,1500, 500,500, 500,500, 500,550, 500,500, 500,500, 500,550, 450,550, 500,500, 500,550, 450,550, 500,500, 500,1500, 500,550, 450,1600, 500,500, 500,500, 500,550, 450,1550, 500}; //Aparelho foi Desligado
int buttonState = 0;
void setup(){
pinMode(on, INPUT);
pinMode(g18, INPUT);
pinMode(g22, INPUT);
pinMode(g25, INPUT);
pinMode(desl, INPUT);
pinMode(led, OUTPUT); // Saída do Led
pinMode(ledIR ,OUTPUT); // Saída do Infravermelho
Serial.begin(9600);
}
void loop() {
//Se o botão ON for pressionado ele ira enviar o código para Ligar o Ar Condicionado
if (digitalRead(on) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendRaw(rawDataon,59,32);
Serial.println("Ar Condicionado Ligado");
}
else {
digitalWrite(led, LOW);
}
//Se o botão 18g for pressionado ele ira para 18 Graus
if (digitalRead(g18) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendRaw(rawData18,59,32);
Serial.println("Temperatura em 18 Graus");
}
else {
digitalWrite(led, LOW);
}
//Se o botão 22g for pressionado ele ira para 22 Graus
if (digitalRead(g22) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendRaw(rawData22,59,32);
Serial.println("Temperatura em 22 Graus");
}
else {
digitalWrite(led, LOW);
}
//Se o botão 25g for pressionado ele ira para 25 Graus
if (digitalRead(g25) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendRaw(rawData25,59,32);
Serial.println("Temperatura em 25 Graus");
}
else {
digitalWrite(led, LOW);
}
//Se o botão OFF for pressionado ele ira enviar o código para Desligar o Ar Condicionado
if (digitalRead(desl) == HIGH) {
digitalWrite(led, HIGH);
irsend.sendRaw(off,200,32);
Serial.println("Ar Condicionado Desligado");
}
else {
digitalWrite(led, LOW);
}
}
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues.
Ativado por