Skip to content

Instantly share code, notes, and snippets.

@vontrapp
Last active August 29, 2015 14:03
Show Gist options
  • Save vontrapp/95696659671e41ab857d to your computer and use it in GitHub Desktop.
Save vontrapp/95696659671e41ab857d to your computer and use it in GitHub Desktop.
LiquidCrystal with custom send functions
#define SHIFTD 5
#define SHIFTC 6
#define ENABLE 7
#include <LiquidCrystal.h>
uint8_t lcd_send(uint8_t value, uint8_t mode, uint8_t nbits) {
uint8_t shift = value << 3;
shift |= (mode && 1) << 1;
shiftOut(SHIFTD, SHIFTC, MSBFIRST, shift);
// pulse ENABLE
digitalWrite(ENABLE, HIGH);
delayMicroseconds(1);
digitalWrite(ENABLE, LOW);
}
LiquidCrystal lcd(lcd_send, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment