Help modding mcufriend_kbv example sketch

I’m using an elegoo mega 2560 r3, elegoo 2.8in tft.

I’ve tried to modify mcufriend_kbv’s example sketch of show_BMP_not_Uno but every time i try to compile it i get errors on the code i’ve copied from the example

the current error is on line 128 - ‘showBMP’ was not declared in this scope

TIA
Dackie

kill_counter_2.ino (11 KB)

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

So do the Auto Format and then take some time to look at your code to check if the automatic indentation matches your intended program structure. Do you see the problem now?

Sorry I'm new to this...
The problem is I don't understand why the errors are in the bit I DIDN'T make and just copied but if I comment out my bit the example works I'm new to coding and don't fully understand it tbh.

Did you do what I told you to do?

Hint: The start of a function should never be indented.

If you're new to coding I recommend you to start working your way through the sketches you will find under File > Examples > Built-in Examples and their associated tutorials:

I kinda understood the tft library but not the mcufriend_kbv one, can I get away with using the built in tft library and just the modified sdfat library?

Dackie:
I kinda understood the tft library but not the mcufriend_kbv one, can I get away with using the built in tft library and just the modified sdfat library?

What is it you are wanting to do?

You are using an Arduino Clone made by elegoo.

I would assume that since Elegoo is selling these two items together that Elegoo has ensured that they do in fact work together.

Have you asked Elegoo for further assistance?

Because the screen is for an uno and I'm using a mega the I need to use software spi for the sd card.

What im trying to achive is a picture displayed on the screen until a button is pressed which adds 1 to a variable then displays the current value of that variable

Dackie:
Because the screen is for an uno and I'm using a mega the I need to use software spi for the sd card.

What im trying to achive is a picture displayed on the screen until a button is pressed which adds 1 to a variable then displays the current value of that variable

Why not just use an Arduino UNO?

That would appear to be the simplest solution.

Because the screen takes up all the inputs of the uno

A regular Mcufriend Uno shield will work on Uno, Mega, Zero, Due, ...

Break your project into small tasks. e.g. unplug the screen

  1. display a counter on Serial
  2. detect a button
  3. increment counter, display it.

Then plug in the screen.

  1. display a counter on TFT
  2. detect a button
  3. increment counter, display it.

Then insert microSD

  1. display one BMP from your microSD
  2. display a counter on TFT
  3. detect a button
  4. increment counter, display it.

Always start with a working program. Simplify if necessary. Adapt a small section. Test.
Rinse and Repeat.
Then do the similar process with your design.

Make sure that you have pencil, paper and a good supply of tea bags before you start.
When tired, leave it for another day.

You only have A5 available for your button when the Shield is in place. You can use it as Digital or Analog.
On a Uno clone A6, A7 are available. These are only Analog.

David.