how to do this???

hi guys

im doing a project with arduino Mega 2560

as u know masters :wink: mega has 6 external interrupt (2,3,18,19,20,21)

i wanted to use 4 of them

but the problem is :

***i must use either i2c communication and 3.5 inch tft lcd

the SDA and SCL pins in i2c communication are 20 and 21 . this means i cant use them for interrupt

the lcd use a lot of pins include 2 and 3 pins

so i have 2 pin that free for using as External interrupt (18,19) and i need 4 :sob: :-[

any way ? 8)

any solution? 8)

2 (failed) IDIA :wink: :smiley:

i tried soft i2c library to use another pins for SCL and SDA but not worked....

can i change the lcd library to use another pins (instad 2,3)?? if yes , HOW?

thanks...

the lcd use a lot of pins include 2 and 3 pins

The LCD may use a lot of pins, but they do NOT have to include 2 and 3.

can i change the lcd library to use another pins (instad 2,3)??

Which LCD library??

(Do all the ? ? ? ? ? ? ? ? ? ? ? contribute a thing?)

ONE is sufficient.

In general, the pins that an LCD uses are defined when the constructor is called. The pins are not hardcoded in the library.

And why do you think you need interrupts?

The question about pins shows us you're a beginner and they tend to have a wrong idea when to use a interrupt... So I'm willing to bed you don't need an interrupt.

im sorry for noobs question...

aliali6624:
Which LCD library??

i used UTFT library

aliali6624:
The LCD may use a lot of pins, but they do NOT have to include 2 and 3.

this is exactly my question

how can i change the library and use two other pin , instead 2 , 3 pins .

so i can use them for Interrupt...

im biginer in Arduino but EXPERT in C++ and im shure that i need interrupt

Then I'll wish good luck with your super secret mission! Because apparently you don't want to share the details...

i used UTFT library

But I'm not going to provide a link to it, or to the LCD...

This question:

how can i change the library and use two other pin , instead 2 , 3 pins .

and this statement

EXPERT in C++

are contradictory.

If you are an EXPERT, surely you know how to look at the call to the library function and decide where all the pins being used by the hardware are being communicated in the call to the constructor, in which case just change the pins actually used and the call to the constructor.

If a change to the library is needed, surely you know how to fire up a text editor and start typing.

aliali6624:
im biginer in Arduino but EXPERT in C++ and im shure that i need interrupt

My wild guess is that you never needed to use an interrupt when programming a PC using C++ so what makes you think you need one for an Arduino?

Tell us what you project is and you will get much more useful assistance.

...R

lets forget about not useless Contention

and focus in the main question

please forget about interrupt :expressionless:

my project is not a secret or something else .... but im not describe it because its really not Necessary

its just confuse u... and not relay on my problem .

so Summary

normally when we attach a standard shield (like an LCD )to a board (like mega 2560 r3), the shield takes

some pins of the board . i want to change two of this pins in hardware .

in fact i want to connect 2 pin of lcd shield ( that normally attach to 2 and 3 pin of mega ) To any other pin ( like 8 , 9 pin of mega)

HOW TO CHANGE THE LIBRARY OF LCD SHIELD (software)??

i think this is a clear question and problem. that no need the library library

but as as i told, i used UTFT lib , 480*320 example

Did you even look at the example sketches included in the utft library?

lg, couka

aliali6624:
my project is not a secret or something else .... but im not describe it because its really not Necessary

its just confuse u... and not relay on my problem .

On the contrary a clear description of the project helps us to understand the context and offer more sensible advice.

...R

Usually, the pin assignments are specified in the constructor or an initialization method.

Is your

enter

broken

because there are

some random line

breaks....

aliali6624:
my project is not a secret or something else .... but im not describe it because its really not Necessary

That's what we like to call a XY problem :wink:

aliali6624:
normally when we attach a standard shield (like an LCD )to a board (like mega 2560 r3), the shield takes some pins of the board . i want to change two of this pins in hardware .

This is exactly why details matter, you never told us it's a shield :wink:

aliali6624:
HOW TO CHANGE THE LIBRARY OF LCD SHIELD (software)??

For a C expert that should take you 1 minute... Less now @aarg gave you a hint.