please help with 2.8 Spi display ili9341

i have a project that i have to do for my school and i've been trying to do it for the last 2-3 weeks my project is simple i have to draw 2 rectangles one with off on it and the second with on in it and when i tech the second one it light a led and when i press the first it turns off the led.
please i need someone to help me write the code

Take a pencil and paper. Draw the flowchart. Hand-trace the logic to check that it works.

Then draw a neat flowchart with all the necessary information. Take photo. Post it here.

Someone will help you with translating your complete flowchart into code.
And help you with any questions.

It is your assignment. You must do the thinking.

David.

like this .(i dont know alot about the screen but)
i know the commands but i cant's get them to work together
that the flowchart that i draw

Go on. You need to put more effort into your flowchart.

This means tracing the flow manually. e.g. what happens after you have detected a Touch?

An embedded program starts at the top and never ends. e.g. setup() and loop()

You also need boxes for initialising display screen, touch panel, LEDs, ...
And arrows to join everything together.

This might end up as several sheets of paper.
It is your design. You have to put every box, diamond, arrow into the flowchart.

I am happy to show you how to translate each box, diamond and arrow into Arduino code statements.

Attaching a JPG or PNG of your photo is easier for readers to use. I can't see how to view your photo without installing some unknown software from your hosting site.

David.

it's my first time drawing a flowchart.
is there any way that we can talk ?
discord or somthing ?

It is a perfectly good school assignment for designing a program e.g. drawing a flowchart.

Actually writing code for your hardware is fairly difficult. Far more advanced than a regular school class.
I can only assume that you are a University student. And you should have been taught how to draw a flowchart.

If not, there is always Wikipedia. Or your school textbooks.
And it is easy enough to draw an arrow that loops forward or back through your boxes e.g. when there is no Touch.

I am in England. My only language is English. If you have a landline telephone I can talk to you. My phone contract provides free calls to most international landline numbers. Not to mobile phones.
PM me with your country and number.

David.

no, i'm not in university I still in school and I can speak English but don't you have other communication methods like discord if you know it. it's a popular voice and text chat you can check it.
I'm really trying to get that display to work and I really want to show my work to my teacher really trusts me he is the one that gave me that display and told me to work in it.

No, I have never used Skype. What country are you in?

Seriously, drawing arrows on a Flowchart is an easy concept.

Post a complete Flowchart and I will give you practical help.

David.

i live in israel .
just want to ask what is wrong with my flowchart ?

Screenshot_2.png

An embedded flow never has an END circle.
After your bottom diamond N an arrow should go back to the test Touch diamond.
After the bottom diamond Y an arrow goes to the turn off box then an arrow back to draw the rectangles.

If you are not happy with flowcharts, you could use numbered steps.
Describe in English which number you go to when a test is YES or NO.

From a language point of view, a graphical flowchart is easy for anyone to understand. Each arrow has a direction. Each box has an action. Each diamond has a conditional Y or N exit.

David.

is this flowchart better?

You are getting there. That is why pencils and erasers were invented.

It is your job to hand-trace every possibility.

Get the arrows where you want them on this page.

This is more than a one-page design.

On a fresh sheet of paper, you will put start circle and your initialisation boxes. i.e. there are important actions to do before you draw the rectangles.

Just put these steps in English. e.g. initialise TouchScreen or initialise LEDs
The important job is to think about "what steps are needed"

I will show you how to code them.

David.

first of all thank you very very much you are helping me a lot to learn new things.

now about the thing that is missing, I think :

  1. the things that I have to #define

2.putting the commands in a void

3.and to define my display something like this : Adafruit_ILI9341 TFT = Adafruit_ILI9341(TFT_CS, TFT_DC);

4.the connection I have an idea about the regular connections but I don't know where to connect the touch part

@Ibrahim,

You appear to have a regular SPI ILI9341 Display with XPT2046 Touch Controller.

It is simple to connect this to a 3.3V Arduino like Zero, Due, 8MHz Pro-Mini, ...

It is more complicated to connect to a 5V Arduino like Uno or Mega2560.
You will either need several 4k7 and 10k resistors to make 3.3V logic
Or some level shifter chip(s).

If you can buy a board like this 3V / 5V Uno clone it would be better than a genuine Uno.

David.

I have Arduino nano and Arduino Uno and I have resistors.

i know something like this

@Ibrahem,

Yes, that is how you wire resistors as potential divider.

But 1k0 is far too small. Use 4k7 on the Arduino side. And 10k on the GND side.

You also need potential dividers for RST and T_CS.

Are you using a breadboard or soldering on matrix board?

Place the 10k and 4k7 resistors on your breadboard with a gap for the display pins:
Place straight links e.g. from oT_DO to oMOSI
-  +   A   B   C   D   E    F  G  H  I  J
               
               oT_IRQ
       MISO----oT_DO
       MOSI----oT_DIN
        SCK----oT_CLK
GND---10k--o   oT_CS - o--4k7--o  o---------->D3
               oMISO - o--4k7--o  o---------->D12
        VCC----oLED
GND---10k--o   oSCK -- o--4k7--o  o---------->D13
GND---10k--o   oMOSI - o--4k7--o  o---------->D11
GND---10k--o   oDC --- o--4k7--o  o---------->D9
GND---10k--o   oRST -- o--4k7--o  o---------->D8
GND---10k--o   oCS --- o--4k7--o  o---------->D10
GND------------oGND --------------o---------->GND
               oVCC --------------o---------->5V

The display plugs into column C.
Run flying leads to a Uno.
Or plug the Nano into the same breadboard.

Much easier with a 3.3V Arduino.  You just have straight wires to the Zero or Due.

Wiring up the display is the hardest part.

Post a photo of your wiring.

Note that The XPT2046 is on the bus. So you must add to any existing TFT programs

    digitalWrite(3, HIGH);   //de-select XPT2046
    pinMode(3, OUTPUT);

David.

I don't understand how to wire those just connect them together
oT_IRQ
MISO----oT_DO
MOSI----oT_DIN
SCK----oT_CLK
?

The XPT2046 and the ILI9341 are both SPI devices. They go on the same SPI bus. With different CS (chip select) pins.

You might be able to fit the display onto column D instead of column C
In which case you can run wire jumpers from T_DIN to column C of the MOSI row.
Similarly T_CLK to column C of the SCK row.
T_DO is easy to connect to the MISO row because there is no 10k on that row.

David.

that is my wiring and you said T_Do I don't have that on my display so I thought you meant T_OUT