Go Down

Topic: Help with this code to blink the LCD screen on my MEGA. Please help.... (Read 1 time) previous topic - next topic


Hello, I am trying to get my MEGA with LCD to blink the screen. Below is the code, it is not working...It gets two errors when I check it, it will not let me copy and paste them for some reason.  :smiley-red: Thanks for any help. Steve

Modified by Lauren
version 0.3

Any suggestions are welcome.
E-mail: Lauran.pan@gmail.com

Editor     : Lauren from DFRobot
Date       : 06.01.2012


* Have the back light under control.
* Update the library and sketch to compatible with IDE V1.0 and earlier


#ifndef LCD4884_h
#define LCD4884_h

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "WProgram.h"

#define SPI_SCK 2
#define SPI_MOSI 3
#define LCD_DC  4
#define SPI_CS  5
#define LCD_RST 6
#define LCD_BL  7

//display mode -- normal / highlight
#define MENU_NORMAL   0
#define OFF 0
#define ON 1

class LCD4884
void LCD_init(void);
void backlight(unsigned char dat);
void LCD_write_byte(unsigned char dat, unsigned char dat_type);
void LCD_draw_bmp_pixel(unsigned char X,unsigned char Y,unsigned char *map,unsigned char Pix_x,unsigned char Pix_y);
void LCD_write_string(unsigned char X,unsigned char Y,char *s, char mode);      
void LCD_write_chinese(unsigned char X, unsigned char Y,unsigned char *c,unsigned char ch_with,unsigned char num,unsigned char line,unsigned char row);
void LCD_write_string_big ( unsigned char X,unsigned char Y, char *string, char mode );
void LCD_write_char_big (unsigned char X,unsigned char Y, unsigned char ch, char mode);
void LCD_write_char(unsigned char c, char mode);
void LCD_set_XY(unsigned char X, unsigned char Y);
void LCD_clear(void);
extern LCD4884 lcd;  
#endif   //


Uhhh, where is your code?

void setup() {

void loop(){

--other functions--
My GitHub:


WTF! I just noticed that now that you mention it, duh! It was the Fleabay seller that emailed me that. Can you fix it by just plugging the missing code in, or is it all wrong? I am VERY new to Arduino coding. Thanks, karma given, Steve.


Jan 11, 2013, 08:23 pm Last Edit: Jan 11, 2013, 08:26 pm by HazardsMind Reason: 1
If you can get the missing code, it may work. There is a LCD example code you can try under, Files/ Examples/ LiquidCrystal. Make sure your pins are correctly wired.
My GitHub:


Yeah that's where I started, but it is a different LCD then what came with my MEGA and so I wrote to the seller and asked for some code and they sent me that. I guess I am going to have to message them back. Thanks anyway, maybe someone else will know. Coding is not my thing (yet)


Looks to me like your guy sent you a library. It's up to you to wrap it with some code to do what you want. What you want will likely be a cross between blink without delay and the method that library has for controlling the backlight.

Would it be accurate to guess that you have two files  LCD4884.h and  LCD4884.cpp?


Yes Jimmy, that's right! Hey if I am having this much trouble getting the thing to blink will I ever get it to print and or interface?

Go Up