Go Down

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

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

Code: [Select]
#define NUM_LCD_ROWS 4
#define NUM_LCD_COLS 20

Code: [Select]
#include "REBLDisplay.h"

extern HardwareSerial Serial;

LiquidCrystal *LCD;

uint8_t redPin;
uint8_t greenPin;
uint8_t bluePin;

char lineBuffer[NUM_LCD_ROWS][NUM_LCD_COLS + 1]; // Leave an extra space for terminating null

color_vars current_color;

boolean cursorActive = false;
uint8_t cursorRow;
uint8_t cursorCol;

void initLCD(uint8_t aRsPin, uint8_t aEnablePin, uint8_t aD1, uint8_t aD2, uint8_t aD3, uint8_t aD4) {

   LCD = new LiquidCrystal(aRsPin, aEnablePin, aD1, aD2, aD3, aD4);



Code: [Select]
#include <LiquidCrystal>
Code: [Select]
#define ENCODER_INTERRUPT_PIN 2 // MUST keep pin 2.
#define ENCODER_B_PIN A0
#define BUTTON_PIN A1
#define LCD_ENABLE_PIN 13
#define LCD_RS_PIN 12
#define HEART_BEAT_PIN A15
//#define LCD_BLUE A0
//#define LCD_GREEN A2
//#define LCD_RED A4
#define LCD_D1 5    // New ↓
#define LCD_D2 4
#define LCD_D3 3
#define LCD_D4 7
const int contrast = 20;    // min. PWM value

void setup() [Replace everything in the curly braces.]
Code: [Select]
  pinMode(8,HIGH);  // LCD pin 15: backlight (anode)
//  pinMode(11,OUTPUT);
//  analogWrite(11,700);
  analogWrite(6,contrast); // PWM~ pins: 3,5,(6),9,10,11. LCD pin 3: Vo (supply for LCD driver)
// Turn on LCD Backlight:
//    lcd.setLED1Pin(1);

Or you can try out the above from this link: github.com/adamaero/REBL_UI

It finally works. The schematic is for the Mega 2560. But it only shows up on half of the LCD (2x16 instead of 4x20). So I think something in "REBLDisplay.cpp" around line 85ish and down would be the change...


Sep 24, 2018, 01:28 pm Last Edit: Sep 24, 2018, 01:37 pm by Davey_Rance
Good morning all i hope that someone can assist me.

I have been trying to get this to compile and work on an adafruit M0 Express board and there were 3 errors. I believe that i have them all resolved but hope this helps someone else.

Steps i did to create the error was clone the repository from https://github.com/adamaero/REBL_UI, Set my board to be adafruit M0 Express and click on verify.

Error 1:
C:\Users\Davey\Documents\Arduino\libraries\REBL_UI\REBLInterface.cpp:28:7: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile byte* {aka volatile unsigned char*}' in assignment

  bReg = portInputRegister(digitalPinToPort(aBPin));

Update line 28 to be:  bReg =  (unsigned char*) portInputRegister(digitalPinToPort(aBPin));

Error 2:
REBLInterface.cpp:61:7: error: 'cli' was not declared in this scope
replace cli(); with noInterrupts(); on line 61

Error 3:
REBLInterface.cpp:64:7: error: 'sei' was not declared in this scope
replace sei(); with interrupts(); on line 64

Thanks and have a great day.


The code here wasn't written for that board.  I don't have one of those M0.  So you're going to have to use this as an example to write code for that board.  Or find some other code that does go with that board.  This was all written for AVR Arduino like UNO and Mega. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.


Hi guys I know this is an older thread but has anyone been able to get this UI to work with an I2C LCD?

I'm a noob and can't seem to figure out what to change.  

My LCD works using the hd44780.h base class by Bill Perry along with the hd44780ioClass/hd44780_I2Cexp.h for the I2C expander on the LCD.

I appreciate any help you can give me.

Go Up