Drwa a circle

with this simple code to draw a circle :

#include <SPI.h>
#include <TFT.h> // Arduino TFT library

#define cs 10
#define dc 9
#define rst 8

TFT screen = TFT(cs, dc, rst);

void setup() {
// initialize the screen
screen.begin();

// make the background black
screen.background(0,0,0);

// set the stroke color to white
screen.stroke(255,255,255);

// set the fill color to grey
screen.fill(127,127,127);

// draw a circle in the center of screen
screen.circle(screen.width()/2, screen.height()/2, 10);
}

void loop() {

}

I got a buch of errors. The SD library is present. Arduino 1.8.13

In file included from C:\Arduino_1.8.13\libraries\TFT\src/TFT.h:36:0,
from C:\Users\Inge\Documents\Arduino\Kleur-herkenning\Draw_Circle\Draw_Circle.ino:2:
C:\Arduino_1.8.13\libraries\TFT\src/utility/Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]
#warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
In file included from C:\Arduino_1.8.13\libraries\TFT\src\TFT.h:36:0,
from C:\Arduino_1.8.13\libraries\TFT\src\TFT.cpp:32:
C:\Arduino_1.8.13\libraries\TFT\src\utility/Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]
#warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
In file included from C:\Arduino_1.8.13\libraries\TFT\src\utility\Adafruit_GFX.cpp:34:0:
C:\Arduino_1.8.13\libraries\TFT\src\utility\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]
#warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
In file included from C:\Arduino_1.8.13\libraries\TFT\src\utility\Adafruit_ST7735.h:28:0,
from C:\Arduino_1.8.13\libraries\TFT\src\utility\Adafruit_ST7735.cpp:19:
C:\Arduino_1.8.13\libraries\TFT\src\utility\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]
#warning "The SD library was not found. loadImage() and image() won't be supported."
^~~~~~~
De schets gebruikt 6736 bytes (20%) programma-opslagruimte. Maximum is 32256 bytes.
Globale variabelen gebruiken 92 bytes (4%) van het dynamisch geheugen. Resteren 1956 bytes voor lokale variabelen. Maximum is 2048 bytes.

What is wrong here ??

Thanks, Henk.

I see no errors, only warnings.

Please remember to use code tags when posting code

#include <SPI.h>
#include <TFT.h>            // Arduino TFT library

Shouldn't you also include:

#include <SD.h>

?

TheMemberFormerlyKnownAsAWOL:
I see no errors, only warnings.

Please remember to use code tags when posting code

Hi. Thanks for your answer. I'm an absolute beginner , so I have more qustions about your answer.

  1. How to tag code ???\
  2. Error or warnings , this code does not produce a circle on my screen.
    Henk.
  1. How to tag code ???\

Please follow the advice on posting code given in posting code

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

hbarkhof:
2. Error or warnings , this code does not produce a circle on my screen.

Well, this is news.

Does the screen initialise after upload?

Can you draw simple diagonal lines?
Text?

What exact TFT display are you using? A link to the product or stat sheet might help, it may be that the library you are using does not support it.

Also how have you hooked it up? A simple diagram might help.

a7

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.