Advertisement
Guest User

lcdIRexample

a guest
Apr 19th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. // include the library code:
  2. #include <LiquidCrystal.h>
  3. #include <IRremote.h>
  4.  
  5.  
  6. // initialize the library with the numbers of the interface pins
  7. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  8. int RECV_PIN = 8;
  9. IRrecv irrecv(RECV_PIN);
  10. decode_results results;
  11.  
  12. void setup() {
  13. irrecv.enableIRIn();
  14.  
  15. // set up the LCD's number of columns and rows:
  16. lcd.begin(16, 2);
  17. // Print a message to the LCD.
  18. lcd.print("hello, world!");
  19. }
  20.  
  21. void loop() {
  22. // set the cursor to column 0, line 1
  23. // (note: line 1 is the second row, since counting begins with 0):
  24. lcd.setCursor(0, 1);
  25. // print the number of seconds since reset:
  26. lcd.print(millis()/1000);
  27.  
  28.  
  29. IRtotext();
  30. irrecv.resume();
  31. }
  32.  
  33.  
  34. void IRtotext() {
  35.  
  36. switch(results.value) {
  37.  
  38. case 0xFFFFFF: { // <--- put the code for whatever button you want associated with this next function
  39.  
  40. lcd.clear();
  41. lcd.print("this button");
  42. lcd.print(millis()/1000);
  43.  
  44. break;
  45. }
  46.  
  47. case 0xFF20DF: { // these are probably going to be different for your remote, but you get the idea.
  48. //^^^ i got these code from my remote by running the IRrelay example on my arduino first, and seeing
  49. // codes go with what buttons.
  50.  
  51.  
  52. lcd.clear(); //clear the display
  53. lcd.print("that button");
  54. lcd.print(millis()/1000);
  55. break;
  56. }
  57.  
  58.  
  59. // you can continue on with as many switch/case functions as you need.
  60.  
  61.  
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement