Mason Cheong
/
programmable_ir_reciever_SIS-2
Basic program that interfaces with a SIS-2 programmable IR reciever
main.cpp@1:75b2a18e16ff, 2014-03-13 (annotated)
- Committer:
- mascheong
- Date:
- Thu Mar 13 19:21:07 2014 +0000
- Revision:
- 1:75b2a18e16ff
- Parent:
- 0:b016fab90911
v2.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mascheong | 0:b016fab90911 | 1 | #include "mbed.h" |
mascheong | 0:b016fab90911 | 2 | |
mascheong | 0:b016fab90911 | 3 | DigitalIn in1(p5); |
mascheong | 0:b016fab90911 | 4 | DigitalIn in2(p6); |
mascheong | 0:b016fab90911 | 5 | DigitalOut learn(p7); |
mascheong | 0:b016fab90911 | 6 | DigitalOut mode(p8); |
mascheong | 0:b016fab90911 | 7 | DigitalOut discrete(p9); |
mascheong | 1:75b2a18e16ff | 8 | DigitalOut led(LED1); //corresponds to Output1 |
mascheong | 1:75b2a18e16ff | 9 | DigitalOut led2(LED2); //corresponds to Output2 |
mascheong | 0:b016fab90911 | 10 | |
mascheong | 0:b016fab90911 | 11 | |
mascheong | 0:b016fab90911 | 12 | int main() { |
mascheong | 0:b016fab90911 | 13 | mode = 0; //set chip mode (0 for mode 1, 1 for mode 2) |
mascheong | 1:75b2a18e16ff | 14 | discrete = 0; //for discrete button mode, mode and discrete should be set to 0 otherwise set to 1 |
mascheong | 0:b016fab90911 | 15 | learn = 0; //pull pin low to activate chip learning |
mascheong | 0:b016fab90911 | 16 | while(in1 == 0) {}; //wait until output1 goes high |
mascheong | 0:b016fab90911 | 17 | learn = 1; //pull up pin |
mascheong | 0:b016fab90911 | 18 | while(1){ |
mascheong | 0:b016fab90911 | 19 | led = in1; //visual feedback for initial programming/first button led indicator |
mascheong | 0:b016fab90911 | 20 | led2 = in2; //second button led indicator |
mascheong | 0:b016fab90911 | 21 | } |
mascheong | 0:b016fab90911 | 22 | } |