Adafruit gfx library issues

hello all, i am trying to use the adafruit gfx library but from what im understanding its not working like it should. i am trying to call out funvction but my IDE just says it wasnt decleared in this scope. here is my code.

( insert Big A@# Bitmap)
const int epd_bitmap_allArray_LEN = 1;
const unsigned char* epd_bitmap_allArray[1] = {
  epd_bitmap_Zips
  };
  #include <SoftwareSerial.h>
  #include <OneWire.h>
  #include <DallasTemperature.h>
 #include <Arduino_DataBus.h>
#include <Arduino_G.h>
#include <Arduino_GFX.h>
#include <Arduino_GFX_Library.h>
#include <Arduino_TFT.h>
#include <Arduino_TFT_18bit.h>
#include <gfxfont.h>

#define LTBLUE    0xB6DF
#define LTTEAL    0xBF5F
#define LTGREEN   0xBFF7
#define LTCYAN    0xC7FF
#define LTRED     0xFD34
#define LTMAGENTA 0xFD5F
#define LTYELLOW  0xFFF8
#define LTORANGE  0xFE73
#define LTPINK    0xFDDF
#define LTPURPLE  0xCCFF
#define LTGREY    0xE71C

#define BLUE      0x001F
#define TEAL      0x0438
#define GREEN     0x07E0
#define CYAN      0x07FF
#define RED       0xF800
#define MAGENTA   0xF81F
#define YELLOW    0xFFE0
#define ORANGE    0xFC00
#define PINK      0xF81F
#define PURPLE    0x8010
#define GREY      0xC618
#define WHITE     0xFFFF
#define BLACK     0x0000

#define DKBLUE    0x000D
#define DKTEAL    0x020C
#define DKGREEN   0x03E0
#define DKCYAN    0x03EF
#define DKRED     0x6000
#define DKMAGENTA 0x8008
#define DKYELLOW  0x8400
#define DKORANGE  0x8200
#define DKPINK    0x9009
#define DKPURPLE  0x4010
#define DKGREY    0x4A49
#define Gold      0xFEA0
  #define ONE_WIRE_BUS 5
  OneWire oneWire(ONE_WIRE_BUS);
  DallasTemperature sensors(&oneWire);


float Celcius = 0;
float F = 0;

  void setup()
{
  init();   //begin display 
  Serial.begin(9600);
  sensors.begin();
  Serial.begin(9600);
setRotation(1);
 fillScreen(0xE71C);
 drawBitmap(0, 0, epd_bitmap_Zips, 480, 320,  0xFEA0);
  delay(4000);
fillScreen(0xE71C);
  setTextSize(1);
  setTextFont(4);
setTextColor(0xFEA0);
 setCursor (190, 60);
 
fillScreen(0xE71C);
 print("WELCOME");
setTextSize(2);
setCursor (149, 135);
 print("   Hunter  ");
setTextSize(1);
  .setCursor (135, 235);
  print("Drive Fast Eat Cake !");

  //delay(3000);
  //tft.fillRect(1,9,150,50,0xE71C);
   
}
  

i kjeep getting errors saying set rotation or fill screen was not decleared in this scope but i copied exactly what was written on ADAfruits website for how to rotate the screen.

Are you sure they say that? It seems like you have inaccurately paraphrased them. Success with Arduino requires attention to precision, and the same goes for getting effective help here on the Arduino forum.

Please post a link to where this is written.

init() what? Is that how the library examples initialize the screen and call functions?

I see no loop() function so the code has no chance to compile.

Post the whole code.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Please post a link to that.

here is the link from adafruits website

yes i know there is no loop functiojn its still a work ijn progress, this is the error i got.

Arduino: 1.8.16 (Windows Store 1.8.51.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"





















C:\Users\max10\OneDrive\Desktop\Baja Daq files\Daq_Code\DAQ_1\DAQ_1.ino: In function 'void setup()':

DAQ_1:1277:1: error: 'setRotation' was not declared in this scope

 setRotation(1);

 ^~~~~~~~~~~

DAQ_1:1278:2: error: 'fillScreen' was not declared in this scope

  fillScreen(0xE71C);

  ^~~~~~~~~~

DAQ_1:1279:2: error: 'drawBitmap' was not declared in this scope

  drawBitmap(0, 0, epd_bitmap_Zips, 480, 320,  0xFEA0);

  ^~~~~~~~~~

DAQ_1:1282:3: error: 'setTextSize' was not declared in this scope

   setTextSize(1);

   ^~~~~~~~~~~

DAQ_1:1283:3: error: 'setTextFont' was not declared in this scope

   setTextFont(4);

   ^~~~~~~~~~~

DAQ_1:1284:1: error: 'setTextColor' was not declared in this scope

 setTextColor(0xFEA0);

 ^~~~~~~~~~~~

DAQ_1:1285:2: error: 'setCursor' was not declared in this scope

  setCursor (190, 60);

  ^~~~~~~~~

C:\Users\max10\OneDrive\Desktop\Baja Daq files\Daq_Code\DAQ_1\DAQ_1.ino:1285:2: note: suggested alternative: 'strerror'

  setCursor (190, 60);

  ^~~~~~~~~

  strerror

DAQ_1:1288:2: error: 'print' was not declared in this scope

  print("WELCOME");

  ^~~~~

C:\Users\max10\OneDrive\Desktop\Baja Daq files\Daq_Code\DAQ_1\DAQ_1.ino:1288:2: note: suggested alternative: 'Print'

  print("WELCOME");

  ^~~~~

  Print

DAQ_1:1293:3: error: expected primary-expression before '.' token

   .setCursor (135, 235);

   ^

exit status 1

'setRotation' was not declared in this scope



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I still do not see the source of that code.

Those all reference Arduino, but the page that you link is Adafruit. So I am confused.

In this example file for the Adafruit GFX and TFT libraries you will see that an instance of the TFT didplay is created in line 41.

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);  // may not be your dislplay but the syntax is proper.
                                                                                                              

In setup() there is a begin() function, not init. Pay attention to the syntax.

 tft.begin(identifier);

And in loop() functions are called like so:

 tft.fillScreen(BLACK);
  tft.fillScreen(RED);
  tft.fillScreen(GREEN);
  tft.fillScreen(BLUE);
  tft.fillScreen(BLACK)

You see that your functions are all missing the tft (or what ever the name is of your display instance).

Now the above may not be for your display, but the syntax is right. I suggest that you work with some library examples from the libraries that you are using to see how the library works before adding any other functionality to the code. Get your display to work, by itself, then add other stuff.

ok yes thank you for pointing that out. i didn't realize it said arduino and not adafruit. that was the issue. i had removed the tft because i thought that could have been the issue. thank you for pointing that out to me. i probably would have stared at this damn code for another 4 hours before i caught that.

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