My project is a servo-enabled, remote controllable heater button (and later on a full-fledged thermostat) since it tends to be pretty cold in my room during winter. But for now, I can't read the codes sent by the remote in the Serial monitor :'(
I am using a UNO board, a TSOP38238 and a mini remote controller bought from adafruit. I've downloaded the lib from Github (https://github.com/adafruit/Adafruit-NE ... ol-library) but I can't get the listener example working using a standard setup (sensor output to pin 2, sensor ground to GND and sensor vcc to +5V). Serial monitor endlessly display the "Timed out waiting!" error message.
I was not sure if IR reception was OK so I plugged in a LED to see if it blinks when receiving signal from the sensor and it does, hence the problem lies elsewhere ...
Picture:
http://imgur.com/uqTL7ld
Code:
/***************************************************
This is an example for the Adafruit NEC Remote Control
Designed specifically to work with the Adafruit NEC Remote Control
----> http://www.adafruit.com/products/389
and IR Receiver Sensor
----> http://www.adafruit.com/products/157
These devices use IR to communicate, 1 pin is required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include "Adafruit_NECremote.h"
// Connect a 38KHz remote control sensor to the pin below
#define IRpin 2
Adafruit_NECremote remote(IRpin);
void setup(void) {
Serial.begin(9600);
Serial.println("Ready to decode IR!");
}
int lastcode = -1;
void loop(void) {
// You can set the listen() time out to 'n' seconds
int c = remote.listen(1); // seconds to wait before timing out!
// Or you can wait 'forever' for a valid code
//int c = remote.listen(); // Without a #, it means wait forever
if (c >= 0) {
Serial.print("Received code #");
Serial.println(c, DEC);
lastcode = c;
} else if (c == -3) {
Serial.print("Repeat (");
Serial.print(lastcode);
Serial.println(")");
} else if (c == -2) {
Serial.println("Data error");
} else {
Serial.println("Timed out waiting!");
}
}
Thanks for your help,
E.

