lg testing
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
//declare variables
float tempC;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
tempC = analogRead(tempPin); //read the value from the sensor
tempC = (5.0 * tempC * 100.0)/1024.0; //convert the analog data to temperature
Serial.println(tempC,1); //send the data to the computer
delay(1000); //wait one second before sending new data
if(tempC > 25 )
{
Serial.println(0x88C005, HEX);
irsend.sendLG(0x88C005,24); // warm, 30 degree, medium high wind
irrecv.resume(); // Receive the next value
irrecv.enableIRIn(); // Start the receiver
}
else if(tempC < 21 )
{
Serial.println(0x8800B4, HEX);
irsend.sendLG(0x8800B4,24); // aircon on
delay(3000);
Serial.println(0x8809b3, HEX);
irsend.sendLG(0x8809b3,24); // warm, 30 degree, medium high wind
delay(3000);
Serial.println(0x8808b3, HEX);
irsend.sendLG(0x8808b3,24); // warm, 30 degree, medium high wind
delay(3000);
Serial.println(0x8807b3, HEX);
irsend.sendLG(0x8807b3,24); // warm, 30 degree, medium high wind
delay(3000);
Serial.println(0x880ab3, HEX);
irsend.sendLG(0x880ab3,24); // warm, 30 degree, medium high wind
irrecv.resume(); // Receive the next value
irrecv.enableIRIn(); // Start the receiver
}
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irsend.sendLG(0x8800B4,24); // aircon on
irrecv.enableIRIn(); //Start the receiver
irrecv.resume(); // Receive the next value
}
}
댓글