Last active
August 29, 2015 14:03
-
-
Save vontrapp/95696659671e41ab857d to your computer and use it in GitHub Desktop.
LiquidCrystal with custom send functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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