I had installed IR control on my room appliances using Arduino. Now I want to add a TM1637 4 Digit 7-Segment display to display time too using the same Arduino. When I tried, all worked well except the IR control. Minimising the hardware along with the programming code, I got to know that the problem is because of TM1637, it somehow interferes with the IR receiver which produces infinite IR signals. I had covered the IR Receiver and it still showing random values So I think the problem is internal. This whole thing happens whenever there is something on display otherwise works alright.
Here is the code I had used:-
#include <IRremote.h>
#include <TM1637Display.h>
#define CLK 11
#define DIO 12
TM1637Display display(CLK, DIO);
uint8_t data[4];
int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
display.setBrightness(5);
data[0] = display.encodeDigit(1);
data[1] = display.encodeDigit(2)|0x80;
data[2] = display.encodeDigit(1);
data[3] = display.encodeDigit(1);
display.setSegments(data);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value);
irrecv.resume();
}
delay(100);
}
Please help me solve this issue.
