Go Down

Topic: Rotary Encoder, Button, and LCD User interface with Menu (Read 1 time) previous topic - next topic

Delta_G

I've been using this same code for a few projects now to create a user interface using a single rotary encoder and a button to drive a menu on an LCD as well as the various user input functions.  I got tired of moving the code from one project to another the hard way so I decided to condense it into a library.  And in response to a few recent posts I thought I would share what I'm doing.  It's called REBL_UI.

It currently uses a different LiquidCrystal library that uses a shift register to save pins on the Arduino and drives the LCD through a shift register on the SPI bus, but could easily be adapted to work with any of the existing flavors of LiquidCrystal with only a few lines of code needing to change.  If you need help with modifications, ask here or on my github page.

The code can be found on my github page along with my LCD library.  There is one simple example code included but for a bigger example see my Disco_Doser code on the same page. 

I don't know if you'll find it useful or not, but it doesn't cost me anything to share it so here it is. 

Link to REBL_UI repo.

Link to LiquidCrystal_SPI_8Bit
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

OldSteve

I have a feeling that a lot of people will find it useful ;)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

LarryD

No technical PMs.
The last thing you did is where you should start looking.

vangalvin

Do you by any chance have an example that uses the LiquidCrystal.h library and an LCD without a shift register?

Kuba_eM

Kuba_eM

vangalvin

I join to the above request
in REBLDisplay.cpp

change to this...
void initLCD(uint8_t aRsPin, uint8_t aEnablePin, uint8_t aD1, uint8_t aD2, uint8_t aD3, uint8_t aD4) {

#ifdef USING_SERIAL
   Serial.begin(19200);
#else
   LCD = new LiquidCrystal(aRsPin, aEnablePin, aD1, aD2, aD3, aD4);
   LCD->begin(NUM_LCD_COLS, NUM_LCD_ROWS);
   LCD->noCursor();
   LCD->clear();
   //setColor(BLUE);

#endif
}

in REBLDisplay.h
Change to this
void initLCD(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);

In your sketch add these
#define LCD_D1 4
#define LCD_D2 5
#define LCD_D3 6
#define LCD_D4 7

and change to this.
initLCD(LCD_RS_PIN, LCD_ENABLE_PIN, LCD_D1, LCD_D2, LCD_D3, LCD_D4);


Pretty sure that was all i used to make it work :)

Oh and I changed the include to use
#include <LiquidCrystal.h>
instead of the SPI one.


snewpers

Not sure if there will be any response but I'll give it a shot anyway.

I would like to use it with and I2C LCD Library and would like to know what it is I should modify?

I've seen several different libraries but planning to use this one: Library

Thanks!

snewpers

in REBLDisplay.cpp

change to this...
void initLCD(uint8_t aRsPin, uint8_t aEnablePin, uint8_t aD1, uint8_t aD2, uint8_t aD3, uint8_t aD4) {

#ifdef USING_SERIAL
   Serial.begin(19200);
#else
   LCD = new LiquidCrystal(aRsPin, aEnablePin, aD1, aD2, aD3, aD4);
   LCD->begin(NUM_LCD_COLS, NUM_LCD_ROWS);
   LCD->noCursor();
   LCD->clear();
   //setColor(BLUE);

#endif
}

in REBLDisplay.h
Change to this
void initLCD(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);

In your sketch add these
#define LCD_D1 4
#define LCD_D2 5
#define LCD_D3 6
#define LCD_D4 7

and change to this.
initLCD(LCD_RS_PIN, LCD_ENABLE_PIN, LCD_D1, LCD_D2, LCD_D3, LCD_D4);


Pretty sure that was all i used to make it work :)

Oh and I changed the include to use
#include <LiquidCrystal.h>
instead of the SPI one.


Tried all this but still loads of errors.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy