Arduino Mega 2560 + 2.8 Resistive Touch Screen + LED panel - HELP!

Hi, I'm hoping I posted this in the right place.

I'm a college student and this is my first year dealing with micro controllers and electronics.

My project is this: I want to click on a button on a touch screen, and have a pattern run on a LED panel.

I have:

1x Arduino Mega 2560 (https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf)
1x Arduino UNO (https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf)

1x Adafruit 2.8" TFT Touch Shield for Arduino with Resistive Touch Screen (Overview | Adafruit 2.8" TFT Touch Shield v2 - Capacitive or Resistive | Adafruit Learning System)
1x Adafruit 32x32 RGB LED matrix panel (Overview | 32x16 and 32x32 RGB LED Matrix | Adafruit Learning System)

I also have:
1 large solder-less breadboard, 1 small solder-less breadboard, jumper wires, OM meter and other assorted electronic paraphernalia.

I have downloaded the correct libraries for each device.

I have tested each device and they all work normally.

If I put the Touch screen shield onto the UNO, there are no pins left for the LED panel.

If I put the Touch screen shield onto the Mega, I need to change some of the pins for the LED panel. The shield covers digital pins 9-11, and analog pins A0-A3 - which the LED panel needs.

My questions:

  1. Is it possible to change the pins that the LED panel requires?
    (So that I can fit the touch screen shield onto the mega and still have enough pins for the LED panel)

  2. Do I have to change the pins in the libraries or can that be done in the sketch/program code?

  3. Should I use the Uno for the Touch screen shield, and the mega for the LED panel?
    (I saw on previous forums that there is a way to connect the two; have the Uno as the master and the mega as the slave)

NOTE: I haven't figured out the code part yet, which is why I haven't included it. I thought I would review the examples for the touch screen and go from there. Right now I'm just trying to see if this idea will even work.

Thank you, and no flames please.

I am not sure that you will be able to get a program that runs both the RGB LED panel and the touchscreen to fit on the Uno, so you will be left using the Mega.

.

Just a hint, all the I2C devices connect on the same two pins. Same for the SPI except the select (CS) pins. Defining pin numbers is dependent on the library you are using.
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars a line and 4 line display
LiquidCrystal_I2C lcd(0x26,16,2); // set the LCD address to 0x26 for a 16 chars a line and 2 line display
//initialize the liquid crystal library
//the first parameter is the I2C address (0x27)
//the second parameter is how characters per row are on your screen
//the third parameter is how many lines are on your screen
The above would set up two displays. Each display on the I2C buss needs initializing but no additional pins required. This actually would allow up to 8 displays.
void setup() // Set up 1 display {
lcd.init(0x27); // initialize the lcd
lcd.backlight(); // Turn backlight on
lcd.setCursor(0,0); // Point cursor to row 0 column 0
lcd.print("Hello Gil!"); // Print a message to the LCD.
SPI is somewhat similar but you need a hardware CS for each device.

ieee488 - Thank you for the quick response. Okay so I will use the Mega for my project and not worry about the Uno.

gilshultz - Thank you for the quick response. Unfortunately, I didn’t understand your answer at all. I am very new at this.

Could you please explain what you said in plain English?

Or point me to a resource where I can learn more in order to understand what you wrote?

What I really want to know is - is this project feasible? Specifically how do you deal with two devices needing to connect on the same pin(s)?

The project should be feasible with the Mega.

But ... I would ask the folks over at Adafruit. They are very helpful and active on their forums.

The panel uses 13 pins so not I2C and the touchscreen is SPI not I2C.

.

ieee488 - Thank you for your help, I will go ask the folks at Adafruit. :slight_smile:

All right,

I am using the Mega for my project.

I have the LED panel hooked up at the moment. I was able to change the analog pins in the code, so that's no longer an issue.

However, I still need to move three digital pins.

They are defined as:

CLK digital pin 11
LAT digital pin 10
OE digital pin 9

According to a diagram of the Mega (https://www.theengineeringprojects.com/ ... mega-5.png)

pins 44, 45 and 46 are PWM - the same as 9, 10, 11.

I tried changing the pins to

CLK digital pin 44
LAT digital pin 45
OE digital pin 46

but that didn't work. My LED panel gave me some strange lines and colors.

Do I need to change the pins in the library for CLK, LAT and OE?

Thanks!

LindaH:
Do I need to change the pins in the library for CLK, LAT and OE?

Don't know.

I don't have this RGB LED panel and have never used it.

.

ieee488 - Thank you, I really do appreciate the help.

It looks like CLK might be determined by hardware, in which case, could I use a bread board to...extend pin 11?

LindaH:
ieee488 - Thank you, I really do appreciate the help.

It looks like CLK might be determined by hardware, in which case, could I use a bread board to...extend pin 11?

Again. Ask Adafruit. They know their hardware.

.