MinitelAsKeyboard.ino 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. Minitel library for Arduino (v0.1) / May 2013
  3. http://github.com/01010101/Minitel
  4. By Jerome Saint-Clair aka 01010101
  5. http://saint-clair.net
  6. For the Graffiti Research Lab France
  7. http://graffitiresearchlab.fr
  8. Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
  9. http://tetalab.org
  10. */
  11. /**
  12. Use Fnct T + E to disable echo
  13. */
  14. #include <Minitel.h>
  15. Minitel minitel;
  16. void setup() {
  17. minitel.clearScreen();
  18. minitel.textMode();
  19. minitel.cursor();
  20. }
  21. void loop() {
  22. minitel.listen(); // Listen for info coming from the Minitel
  23. minitel.readKey(); // Try to read a key press
  24. if (minitel.isCharacterKey()) {
  25. char key = minitel.getCharacterKey();
  26. minitel.textChar(key);
  27. }
  28. else if (minitel.isMenuKey()) {
  29. int key = minitel.getMenuKey();
  30. if (key == RETOUR) { // Return
  31. minitel.moveCursorTo(HOME);
  32. minitel.moveCursor(DOWN, 1);
  33. }
  34. else if (key == CORRECTION) {
  35. minitel.moveCursor(LEFT, 1);
  36. minitel.textChar(' ');
  37. minitel.moveCursor(LEFT, 1);
  38. }
  39. else if (key == ANNULATION) {
  40. minitel.clearScreen();
  41. }
  42. }
  43. }