IR Kit SKU:DFR0107
Part | Datasheet |
---|---|
![]() |
DFR0107 (pdf) |
PDF Datasheet Preview |
---|
IR Kit SKU:DFR0107 Contents • 1 Introduction • 2 Sample Code • 3 Trouble shooting • 4 More Introduction IR is widely used in remoter control. With this IR receiver, the Arduino project is able to receive command from any IR remoter controller if you have the right decoder. Well, it will be also easy to make your own IR controller using IR transmitter. Sample Code // by pmalmsten 4 // by farkinga // by farkinga - adds cool behaviors /* by pstrobl changed the original program to use on IR Kit For Arduino Model DFR0107 3 2 bit controller. All keypresses are sent to the serial monitor at 9600 baud. pulseIn is always HIGH. The phototransistor in the kit does not invert the signal. uses pin 13 for heartbeat debug 32 bits requires a long variable, so divided up into two 15 bit so can use integer variables use the first 15 bits of the 32 bits for remote and data stream verificati on. This code is always the same for every button press use the last 15 of the 32 bits for button press selection. This code chang es for each button. ignore the middle 2 bits, it never changes. #define IR_BIT_LENGTH 32 // number of bits sent by IR remote #define FirstLastBit 15 // divide 32 bits into two 15 bit chunks for inte ger variables. Ignore center two bits. they are all the same. #define BIT_1 1500 // Binary 1 threshold Microseconds #define BIT_0 450 // Binary 0 threshold Microseconds #define BIT_START 4000 // Start bit threshold Microseconds #define IR_PIN 2 #define LED_PIN 13 // IR Sensor pin // LED goes off when signal is received int debug = 0 ength in microseconds // flag as 1 to output raw IR pulse data stream l int output_verify = 0; // flag as 1 to print decoded verification intege rs. same number for all buttons int output_key = 0; // flag as 1 to print decoded key integers int remote_verify = 16128 // verifies first bits are differe nt remotes may have different start codes void setup pinMode LED_PIN, OUTPUT //This shows when ready to recieve pinMode IR_PIN, INPUT digitalWrite LED_PIN, LOW Serial.begin 9600 ; void loop digitalWrite LED_PIN, HIGH ; int key = get_ir_key ; digitalWrite LED_PIN, LOW // turn LED off while processing response do_response key ; delay 130 s // 2 cycle delay to cancel duplicate keypresse /* wait for a keypress from the IR remote, and return the integer mapping of that key e.g. power button on remote returns the integer 1429 |
Notice: we do not provide any warranties that information, datasheets, application notes, circuit diagrams, or software stored on this website are up-to-date or error free. The archived DFR0107 Datasheet file may be downloaded here without warranties.