简体   繁体   中英

Arduino LCD2004D Sketch for Mega

I've been hunting this down for a couple of days now and simply haven't been making any headway.

I have a http://reprap.org/wiki/RepRapDiscount_Smart_Controller it came with a kit from china.

I'm trying to interact with the LCD, and the SD card reader.

Every single piece of info I can find tells me to use LiquidCrystal.h, All of them tell me what pins to use on an Uno, and every time I find someone with a Mega, the person is having the same problem as me, there's something hard coded somewhere, that does not translate to an Arduino Mega.

So simply put, can someone who has some experience with this, give a sketch for the MEGA + RAMPS1.4 + LCD2004D + SD Card Reader

This is what I have managed to get so far

#define LCD_RS 16
#define LCD_ENABLE 17
#define LCD_D1 23
#define LCD_D2 25
#define LCD_D3 27
#define LCD_D4 29

 //encoder pins  
#define BTN_EN1 31
#define BTN_EN2 33
#define BTN_ENC 35

 //beeper
#define BEEPER 37

 //SD card detect pin  
#define SDCARDDETECT 49

#define SDPOWER            -1
#define MOSI  51
#define MISO  50
#define SCK   52
#define SDSlaveSelect 53

I have confirmed that these ARE the correct pins as connected via the RAMPS1.4 jumper board and EXT 1 and EXT 2 connectors, though I can't confirm that they are linked to what I have written here, since there's no real info for this that I can get my hands on.

And Please Please Please if you can help, or do help, make your answer easy to decode, because I will be working with the LCD Controller for now, and may upgrade later, so I hopefully will learn something here for when I switch controllers then!

(or a working sketch would be AweSome!)

Thank you anyone in advance.

Here is the lcd 1602 model which is the smaller brother of the 2004, https://www.sunfounder.com/learn/Super-Kit-V2-0-for-Arduino/lesson-8-lcd1602-super-kit.html it illustrates how to connect and program for Arduino using the parallel connection which is similar to the 2004 model.

A lot of the lcds that i have seen for the 2004 model have a serial to parallel driver board which could be an option as driving an i2c board is easier to implement and uses less pins.

For example http://www.ebay.com/itm/IIC-I2C-TWI-SP-I-Serial-Interface-Board-Module-LCD1602-2004-Display-For-Arduino-/172591106177?hash=item282f3b4881:g:jDoAAOSw4CFY1JTI

i hope this has given you some ideas to try out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM