Advertisement
KRITSADA

IPST-SE Sony Infrared Remote Control with

Jun 16th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.   use IPST-SE from http://inex.co.th  and ZX-IRM for RC5 (Sony Remote Control) Receiver.
  3.   Send data to ZX-LED8 (1 to 8 Serial LED Driver)
  4. */
  5. #include <ipst.h>
  6. #include <IRremote.h>
  7. word key[]={ 16,2064,1040,3088,528,2576,1552,3600};
  8. word x;
  9. int i,c[8],val=0;
  10. IRrecv irrecv(24);
  11. decode_results results;
  12. void setup(){
  13.   irrecv.enableIRIn();
  14.   setTextSize(2);
  15.   glcdFillScreen(GLCD_YELLOW);
  16.   setTextBackgroundColor(GLCD_YELLOW);
  17.   setTextColor(GLCD_BLUE);
  18.   glcd(1,0," PRESS KEY");
  19. }
  20. void loop(){
  21.   if (irrecv.decode(&results)) {
  22.     x=results.value;
  23.     setTextSize(1);
  24.     setTextColor(GLCD_GREEN);
  25.     glcd(15,0,"%d   ",x);  
  26.     for(i=0;i<8;i++){
  27.       if (x==key[i]){
  28.         setTextSize(3);
  29.         setTextColor(GLCD_MAGENTA);
  30.         glcd(2,0," %d     ",i+1);  
  31.         val=val^(1<<i);
  32.         LED8(15,val);delay(100);  
  33.       }
  34.       else if (x==2704){
  35.         val=0;
  36.         LED8(15,val);  
  37.         setTextSize(3);
  38.         setTextColor(GLCD_MAGENTA);
  39.         glcd(2,0,"ALL OFF");  
  40.       }
  41.       else if (x==656){
  42.         val=255;
  43.         LED8(15,val);  
  44.         setTextSize(3);
  45.         setTextColor(GLCD_MAGENTA);
  46.         glcd(2,0,"ALL ON ");  
  47.       }
  48.      
  49.     }
  50.     irrecv.resume(); // Receive the next value
  51.   }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement