Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- use IPST-SE from http://inex.co.th and ZX-IRM for RC5 (Sony Remote Control) Receiver.
- Send data to ZX-LED8 (1 to 8 Serial LED Driver)
- */
- #include <ipst.h>
- #include <IRremote.h>
- word key[]={ 16,2064,1040,3088,528,2576,1552,3600};
- word x;
- int i,c[8],val=0;
- IRrecv irrecv(24);
- decode_results results;
- void setup(){
- irrecv.enableIRIn();
- setTextSize(2);
- glcdFillScreen(GLCD_YELLOW);
- setTextBackgroundColor(GLCD_YELLOW);
- setTextColor(GLCD_BLUE);
- glcd(1,0," PRESS KEY");
- }
- void loop(){
- if (irrecv.decode(&results)) {
- x=results.value;
- setTextSize(1);
- setTextColor(GLCD_GREEN);
- glcd(15,0,"%d ",x);
- for(i=0;i<8;i++){
- if (x==key[i]){
- setTextSize(3);
- setTextColor(GLCD_MAGENTA);
- glcd(2,0," %d ",i+1);
- val=val^(1<<i);
- LED8(15,val);delay(100);
- }
- else if (x==2704){
- val=0;
- LED8(15,val);
- setTextSize(3);
- setTextColor(GLCD_MAGENTA);
- glcd(2,0,"ALL OFF");
- }
- else if (x==656){
- val=255;
- LED8(15,val);
- setTextSize(3);
- setTextColor(GLCD_MAGENTA);
- glcd(2,0,"ALL ON ");
- }
- }
- irrecv.resume(); // Receive the next value
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement