Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // include the library code:
- #include <LiquidCrystal.h>
- #include <IRremote.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
- int RECV_PIN = 8;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup() {
- irrecv.enableIRIn();
- // set up the LCD's number of columns and rows:
- lcd.begin(16, 2);
- // Print a message to the LCD.
- lcd.print("hello, world!");
- }
- void loop() {
- // set the cursor to column 0, line 1
- // (note: line 1 is the second row, since counting begins with 0):
- lcd.setCursor(0, 1);
- // print the number of seconds since reset:
- lcd.print(millis()/1000);
- IRtotext();
- irrecv.resume();
- }
- void IRtotext() {
- switch(results.value) {
- case 0xFFFFFF: { // <--- put the code for whatever button you want associated with this next function
- lcd.clear();
- lcd.print("this button");
- lcd.print(millis()/1000);
- break;
- }
- case 0xFF20DF: { // these are probably going to be different for your remote, but you get the idea.
- //^^^ i got these code from my remote by running the IRrelay example on my arduino first, and seeing
- // codes go with what buttons.
- lcd.clear(); //clear the display
- lcd.print("that button");
- lcd.print(millis()/1000);
- break;
- }
- // you can continue on with as many switch/case functions as you need.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement