verifing sketch

If I have problems verifying a sketch that was downloaded from a web site could I be using the wrong IDE? I am using the latest IDE 1.8.8 and the sketch could have been written using an earlier IDE. Thanks!

Perhaps post the code you're trying to compile along with the full error messages.

It's a pretty sizable sketch, is that ok?

Yes, it is, e.g. as attachment. Or, post the link to site.

There are some errors that are caused by changes in the IDE and others that are caused by invisible characters that sometimes get included when you copy text from a web page. A third class of errors would indicate that the latest libraries are different from the versions used wen the sketch was written. The compiler errors would probably tell us more than the source code.

I find that most such errors are fairly easy to fix (the invisible characters being the worst!).

If I get rid of the library it doesn’t like it has a lot of problems with all the lines with "TFT, tft.

Wireless_weather_station__Transmitter.ino (4.76 KB)

That is a lot of error messages, does the library depend on any other library ? otherwise maybe try the adafruit lib for it.

I don't know. The one who wrote the sketch used these libraries. I assume it was a usable sketch??? :confused:

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here using code tags (</> button on the forum toolbar).

There is a ‘}’ missing at the end of that sketch. You probably just missed it when you copied and pasted.

The library you need can be found at: GitHub - Bodmer/TFT_HX8357: Arduino library for HX8357 TFT display

Click on the “Clone or download” button and when the dialog pops up, click on “Download ZIP”.
Then in the Arduino IDE select: Sketch->Include Library->Add .ZIP library
Point it to the .zip you downloaded. and it will install the library.

After that the sketch should compile without errors. There are a pile of WARNINGS, but they won’t stop the compile from finishing.

In file included from /Users/john/Documents/Arduino/sketch_dec06a/sketch_dec06a.ino:5:0:
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.h:124:0: warning: "HX8357B" redefined
 #define HX8357B 0xB
 ^
In file included from /Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.h:19:0,
                 from /Users/john/Documents/Arduino/sketch_dec06a/sketch_dec06a.ino:5:
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/User_Setup.h:13:0: note: this is the location of the previous definition
 #define HX8357B
 ^
In file included from /Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:38:0:
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.h:124:0: warning: "HX8357B" redefined
 #define HX8357B 0xB
 ^
In file included from /Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.h:19:0,
                 from /Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:38:
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/User_Setup.h:13:0: note: this is the location of the previous definition
 #define HX8357B
 ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'void TFT_HX8357::fillTriangle(int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, uint16_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:748:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (uint16_t i = 0; i < dx1;) {
                            ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:753:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(i<dx1) {
                ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:756:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   while (e1 >= dx1) {
                             ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:769:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while (e2 >= dx2) {
                       ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:803:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (uint16_t i = 0; i<=dx1; i++) {
                           ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:808:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(i<dx1) {
                ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:810:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   while (e1 >= dx1) {
                             ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:817:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(i<dx1) i++;
                 ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:823:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   while (e2 >= dx2) {
                             ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'void TFT_HX8357::drawChar(int16_t, int16_t, uint8_t, uint16_t, uint16_t, uint8_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1173:14: warning: unused variable 'xa' [-Wunused-variable]
              xa = pgm_read_byte(&glyph->xAdvance);
              ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'void TFT_HX8357::drawPixel(uint16_t, uint16_t, uint16_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1409:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if ((x >= _width) || (y >= _height)) return;
          ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1409:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if ((x >= _width) || (y >= _height)) return;
                           ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'virtual size_t TFT_HX8357::write(uint8_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1951:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (textwrap && (cursor_x + width * textsize >= _width))
                                                  ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'int16_t TFT_HX8357::drawChar(uint16_t, int16_t, int16_t, int16_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2085:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (x + width * textsize >= _width) return width * textsize ;
                              ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2091:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int16_t i = 0; i < height; i++)
                             ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2129:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if ((y + height - 1) >= _height) y = _height - height;
                            ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2132:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int16_t i=0; i<height; i++)
                         ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2209:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (px >= (x + width * textsize))
                    ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2171:31: warning: unused variable 'tpy' [-Wunused-variable]
       int16_t px = 0, py = y, tpy = y; // To hold character block start and end column and row values
                               ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'int16_t TFT_HX8357::drawString(char*, int16_t, int16_t, int16_t)':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2345:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (poX+cwidth>_width)   poX = _width - cwidth;
                   ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2347:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (poY+cheight-baseline>_height) poY = _height - cheight;
                             ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:2368:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if((padX>cwidth) && (textcolor!=textbgcolor))
           ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp: In member function 'drawChar.constprop':
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1177:20: warning: 'yo16' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int16_t  xo16, yo16;
                    ^
/Users/john/Documents/Arduino/libraries/TFT_HX8357-master/TFT_HX8357.cpp:1177:14: warning: 'xo16' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int16_t  xo16, yo16;
              ^
Sketch uses 29922 bytes (11%) of program storage space. Maximum is 253952 bytes.
Global variables use 364 bytes (4%) of dynamic memory, leaving 7828 bytes for local variables. Maximum is 8192 bytes.

yeah i saw that brace as well, but after that i still got stuck with all of these error msgs

Arduino: 1.6.12 (Windows 8.1), TD: 1.35, Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In constructor 'TFT_HX8357::TFT_HX8357(int16_t, int16_t)':

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:80:3: error: 'DDRA' was not declared in this scope

   DDRA = 0xFF; // Set direction for the 2 8 bit data ports

   ^

In file included from C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:38:0:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In member function 'void TFT_HX8357::writecommand(uint8_t)':

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:88:20: error: 'PORTG' was not declared in this scope

 #define SETUP_CS_L PORTG&= ~_BV(1)

                    ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:131:1: note: in expansion of macro 'SETUP_CS_L'

 SETUP_CS_L;

 ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:133:1: error: 'PORTA' was not declared in this scope

 PORTA = 0;

 ^

In file included from C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:38:0:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In member function 'void TFT_HX8357::writedata(uint8_t)':

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:88:20: error: 'PORTG' was not declared in this scope

 #define SETUP_CS_L PORTG&= ~_BV(1)

                    ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:146:1: note: in expansion of macro 'SETUP_CS_L'

 SETUP_CS_L;

 ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:147:1: error: 'PORTA' was not declared in this scope

 PORTA = c>>8;

 ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In member function 'void TFT_HX8357::drawChar(int16_t, int16_t, uint8_t, uint16_t, uint16_t, uint8_t)':

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1109:45: error: 'PORTA' was not declared in this scope

       if (column[0] & mask) {PORTC = color; PORTA = color>>8;}

                                             ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1110:25: error: 'PORTA' was not declared in this scope

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                         ^

In file included from C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:38:0:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:83:18: error: 'PORTG' was not declared in this scope

   #define WR_STB PORTG&=~_BV(2);PORTG|=_BV(2);

                  ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1110:41: note: in expansion of macro 'WR_STB'

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                                         ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1111:45: error: 'PORTA' was not declared in this scope

       if (column[1] & mask) {PORTC = color; PORTA = color>>8;}

                                             ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1112:25: error: 'PORTA' was not declared in this scope

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                         ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1113:45: error: 'PORTA' was not declared in this scope

       if (column[2] & mask) {PORTC = color; PORTA = color>>8;}

                                             ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1114:25: error: 'PORTA' was not declared in this scope

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                         ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1115:45: error: 'PORTA' was not declared in this scope

       if (column[3] & mask) {PORTC = color; PORTA = color>>8;}

                                             ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1116:25: error: 'PORTA' was not declared in this scope

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                         ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1117:45: error: 'PORTA' was not declared in this scope

       if (column[4] & mask) {PORTC = color; PORTA = color>>8;}

                                             ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1118:25: error: 'PORTA' was not declared in this scope

       else {PORTC = bg; PORTA = bg>>8;} WR_STB;

                         ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1120:19: error: 'PORTA' was not declared in this scope

       PORTC = bg; PORTA = bg>>8; WR_STB;

                   ^

In file included from C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:38:0:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:92:16: error: 'PORTG' was not declared in this scope

   #define CS_H PORTG|=_BV(1)

                ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:1123:5: note: in expansion of macro 'CS_H'

     CS_H;

     ^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In member function 'void TFT_HX8357::setWindow(int16_t, int16_t, int16_t, int16_t)':

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:92:16: error: 'PORTG' was not declared in this scope

so an Error in the constructor basically, the rest follows from there. so many in fact i exceeded 9000 chars.

Thank You! I will give it a try. I'll let you know.

Deva_Rishi:
yeah i saw that brace as well, but after that i still got stuck with all of these error msgs

Arduino: 1.6.12 (Windows 8.1), TD: 1.35, Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In constructor ‘TFT_HX8357::TFT_HX8357(int16_t, int16_t)’:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:80:3: error: ‘DDRA’ was not declared in this scope

DDRA = 0xFF; // Set direction for the 2 8 bit data ports

^

In file included from C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:38:0:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp: In member function ‘void TFT_HX8357::writecommand(uint8_t)’:

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.h:88:20: error: ‘PORTG’ was not declared in this scope

#define SETUP_CS_L PORTG&= ~_BV(1)

^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:131:1: note: in expansion of macro ‘SETUP_CS_L’

SETUP_CS_L;

^

C:\Program Files (x86)\Arduino\libraries\TFT_HX8357-master\TFT_HX8357.cpp:133:1: error: ‘PORTA’ was not declared in this scope

PORTA = 0;

^



so an Error in the constructor basically, the rest follows from there. so many in fact i exceeded 9000 chars.

The Arduino UNO doesn’t have a PORTA or PORTG. I guess I got lucky when I accidentally had my “Board” set to Arduino MEGA from a previous compile.