Wednesday, August 8, 2018

LCD without pot for Arduino with menu using rotary encoder

Here's some sample code (note: will not compile) just to give you an idea:
  1. /*
  2. * Arduino LCD
  3. */
  4. #include <LiquidCrystal.h>

  5. /* Menu */
  6. #define MOVECURSOR 9 // Basically the same thing as const [whatever]
  7. const int contrast = 20; // min. PWM value
  8. const int menuTimeout = 10000; // time to timeout in a menu when user doesn't do anything.

  9. LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Arduino pins ~ creates LC object.
  10. // Parameters: (rs, enable, d4, d5, d6, d7) // LCD pins
  11. void setup() { // Setups things like bit rate or to change pins to output
  12. lcd.begin(totCols,totRows); // (width, height)
  13. }
  14. void loop() { // Iterates forever once loaded on Arduino
  15. lcd.setCursor(0,0);
  16. lcd.print("Effective Altruism movement");
  17. }
Probably eventually going to need to use this:
  1. lcd.noCursor();
  2. lcd.clear();
See electronics.stackexchange.com/a/111275/59133 with:
playground.arduino.cc/Main/TimerPWMCheatsheet
Extra - forum.arduino.cc/index.php?topic=207772.0

Toggle backlight link.

Bonus - Tinkercad keyboard + LCD
------------------------------PINOUT------------------------------



------------------------------MENU------------------------------
Delta_G recommends using his menu: 
If using, this post helps: 
  • https://forum.arduino.cc/index.php?topic=358066.msg3841709#msg3841709
My LCD screen is a 4x20 (rows by columns) with the same pinouts from the picture and schematic above. Here is my edits of Delta_G's library: 
Here is the discussion on it: 
  • https://forum.arduino.cc/index.php?topic=561064.30



No comments:

Post a Comment