Advertisement
Pew446

Chatpad Working

Oct 8th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #ifndef ARDUINO
  2. #include "stdafx.h"
  3. #include <conio.h>
  4. #endif
  5.  
  6. #include "Chatpad.h"
  7. Chatpad pad;
  8.  
  9. #include <LiquidCrystal.h>
  10.  
  11. LiquidCrystal lcd(7, 6, 2, 3, 4, 5);
  12.  
  13. void loop()
  14. {
  15.   pad.poll();
  16. }
  17.  
  18. void print_keys(Chatpad &pad, Chatpad::keycode_t code,
  19.     Chatpad::eventtype_t type) {
  20.   if (type == Chatpad::Down) {
  21.     char a = pad.toAscii(code);
  22.     if (a != 0)
  23.    {
  24.     lcd.print(a);
  25.    }
  26.   }
  27. }
  28.  
  29. void setup()
  30. {
  31.   // set up the LCD's number of columns and rows:
  32.   lcd.begin(20, 4);
  33.   pad.init(Serial, print_keys);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement