0% found this document useful (0 votes)
12 views

Ir Number Entry - HTML

Uploaded by

Mohammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Ir Number Entry - HTML

Uploaded by

Mohammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <IRremote.

h>
int RECV_PIN = 2;
int index = 0;
unsigned int SpaN;
unsigned int offset = 0;
unsigned int count;
unsigned int DisplayOne;
unsigned int DisplayTwo;
unsigned int MyDigit;
unsigned long lastCode;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
delay(300);
SpaN = millis() - offset;
if (irrecv.decode(&results)) {

if (results.value != 4294967295) {
lastCode = results.value;
}
irrecv.resume();

if ( results.value == 0x25DA2AD5) { //Serial.println("1");


count = 1; index++; delay(300);
}
if ( results.value == 0x25DA6897) { //Serial.println("2");
count = 2; index++; delay(300);
}
if (results.value == 0x25DAA857) { //Serial.println("3");
count = 3; index++; delay(300);
}
if ( results.value == 0x25DA0AF5) { //Serial.println("4");
count = 4; index++; delay(300);
}
if ( results.value == 0x25DA48B7) { //Serial.println("5");
count = 5; index++; delay(300);
}

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
if ( results.value == 0x25DA8877) { //Serial.println("6");
count = 6; index++; delay(300);
}
if ( results.value == 0x25DA32CD) { //Serial.println("7");
count = 7; index++; delay(300);
}
if ( results.value == 0x25DA708F) { //Serial.println("8");
count = 8; index++; delay(300);
}
if ( results.value == 0x25DAB04F) { //Serial.println("9");
count = 9; index++; delay(300);
}
if ( results.value == 0x25DA30CF) { //Serial.println("0");
count = 0; index++; delay(300);
}
if (index == 1) {
DisplayOne = count; offset = millis();

}
if (index == 2 && SpaN<5000) { index = 0;
DisplayTwo = count;

MyDigit = DisplayOne * 10 + DisplayTwo;


Serial.print("My Digit = "); Serial.println(MyDigit);
delay(400);

}
if (index == 2 && SpaN > 5000) {
DisplayOne = 0;
DisplayTwo = count;
MyDigit = DisplayOne * 10 + DisplayTwo;
//Serial.println("SpaN>5000"); //
Serial.print("My Digit= "); Serial.println(MyDigit);
index = 0; delay(400);

}
Serial.println(" "); Serial.println(" ");
}
}

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD

You might also like