Manejo de Un LCD 16x2
Manejo de Un LCD 16x2
#include <wiringPi.h>
#include <lcd.h>
#include <stdio.h>
#include <stdlib.h>
//#include <stdint.h>
#ifndef TRUE
# define TRUE (1==1)
# define FALSE (1==2)
#endif
if (dir == 0) {
dir = 1 ;
lcdPosition (lcd, 0, 0) ;
lcdPutchar (lcd, '*') ;
lcdPosition (lcd, cols-1, 1) ;
lcdPutchar (lcd, '*') ;
//return ;
}
position += dir ;
if (position == cols) {
dir = -1 ;
--position ;
}
if (position < 0) {
dir = 1 ;
++position ;
}
}
}
int main(){
int fd;
// (rows, cols, mode, RS, STR, d0, d1, d2, d3, d4, d5, d6, d7)
fd = lcdInit (2, 16, 4, 11, 10, 4, 5, 6, 7, 0, 0, 0, 0) ;
if (fd < 0) {
fprintf (stderr, "lcdInit failed\n") ;
exit(EXIT_FAILURE) ;
}
wiringPiSetup () ;
lcdClear(fd);
lcdHome(fd);
lcdCursor(fd, FALSE);
waitForEnter();
lcdClear(fd);
pingPong(fd, 16,4);
lcdClear(fd);