ST7735 does not name a type...Please help

Hello. I am trying to program a 1.8" TFT LCD with my arduino. While running the sample coe provided, I am getting several error messages…

graphicstest_highspeed:31: error: 'ST7735 does not name a type

There are several other messages but this is the main message. Here is the full sample code:

// Pins SCLK and MOSI are fixed in hardware, and pin 10 (or 53) 
// must be an output
//#define sclk 13    // for MEGAs use pin 52
//#define mosi 11    // for MEGAs use pin 51
#define cs 10   // for MEGAs you probably want this to be pin 53
#define dc 9
#define rst 8  // you can also connect this to the Arduino reset

// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0  
#define WHITE           0xFFFF

#include <ST7735.h>
#include <SPI.h>

// Option 1: use any pins but a little slower
//ST7735 tft = ST7735(cs, dc, mosi, sclk, rst);  

// Option 2: must use the hardware SPI pins 
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be 
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
ST7735 tft = ST7735(cs, dc, rst);    

void fillpixelbypixel(uint16_t color) {
  for (uint8_t x=0; x < tft.width; x++) {
    for (uint8_t y=0; y < tft.height; y++) {
      tft.drawPixel(x, y, color);
    }
  }
  delay(100);
}

void setup(void) {
  Serial.begin(9600);
  Serial.print("hello!");
  tft.initR();               // initialize a ST7735R chip

  Serial.println("init");
  tft.writecommand(ST7735_DISPON);
  
  uint16_t time = millis();
  tft.fillScreen(BLACK);
  time = millis() - time;
  
  Serial.println(time, DEC);
  delay(500);
  
  //
  tft.fillScreen(BLACK);
  testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", WHITE);
  delay(10000);
  
  //a single pixel
  tft.drawPixel(tft.width/2, tft.height/2, GREEN);
  delay(500);
  
  // line draw test
  testlines(YELLOW);
  delay(500);    
  
  // optimized lines
  testfastlines(RED, BLUE);
  delay(500);    

  testdrawrects(GREEN);
  delay(500);

  testfillrects(YELLOW, MAGENTA);
  delay(500);

  tft.fillScreen(BLACK);
  testfillcircles(10, BLUE);
  testdrawcircles(10, WHITE);
  
  Serial.println("done");
  delay(1000);
}

void loop() {
  tft.writecommand(ST7735_INVON);
  delay(500);
  tft.writecommand(ST7735_INVOFF);
  delay(500);
}

void testlines(uint16_t color) {
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width; x+=6) {
     tft.drawLine(0, 0, x, tft.height-1, color);
   }
   for (uint16_t y=0; y < tft.height; y+=6) {
     tft.drawLine(0, 0, tft.width-1, y, color);
   }
   
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width; x+=6) {
     tft.drawLine(tft.width-1, 0, x, tft.height-1, color);
   }
   for (uint16_t y=0; y < tft.height; y+=6) {
     tft.drawLine(tft.width-1, 0, 0, y, color);
   }
   
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width; x+=6) {
     tft.drawLine(0, tft.height-1, x, 0, color);
   }
   for (uint16_t y=0; y < tft.height; y+=6) {
     tft.drawLine(0, tft.height-1, tft.width-1, y, color);
   }

   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width; x+=6) {
     tft.drawLine(tft.width-1, tft.height-1, x, 0, color);
   }
   for (uint16_t y=0; y < tft.height; y+=6) {
     tft.drawLine(tft.width-1, tft.height-1, 0, y, color);
   }
   
}

void testdrawtext(char *text, uint16_t color) {
  tft.drawString(0, 0, text, color);
}

void testfastlines(uint16_t color1, uint16_t color2) {
   tft.fillScreen(BLACK);
   for (uint16_t y=0; y < tft.height; y+=5) {
     tft.drawHorizontalLine(0, y, tft.width, color1);
   }
   for (uint16_t x=0; x < tft.width; x+=5) {
     tft.drawVerticalLine(x, 0, tft.height, color2);
   }
}

void testdrawrects(uint16_t color) {
 tft.fillScreen(BLACK);
 for (uint16_t x=0; x < tft.width; x+=6) {
   tft.drawRect(tft.width/2 -x/2, tft.height/2 -x/2 , x, x, color);
 }
}

void testfillrects(uint16_t color1, uint16_t color2) {
 tft.fillScreen(BLACK);
 for (uint16_t x=tft.width-1; x > 6; x-=6) {
   tft.fillRect(tft.width/2 -x/2, tft.height/2 -x/2 , x, x, color1);
   tft.drawRect(tft.width/2 -x/2, tft.height/2 -x/2 , x, x, color2);
 }
}

void testfillcircles(uint8_t radius, uint16_t color) {
  for (uint8_t x=radius; x < tft.width; x+=radius*2) {
    for (uint8_t y=radius; y < tft.height; y+=radius*2) {
      tft.fillCircle(x, y, radius, color);
    }
  }  
}

void testdrawcircles(uint8_t radius, uint16_t color) {
  for (uint8_t x=0; x < tft.width+radius; x+=radius*2) {
    for (uint8_t y=0; y < tft.height+radius; y+=radius*2) {
      tft.drawCircle(x, y, radius, color);
    }
  }  
}

Thanks for all the help guys! What am I doing wrong? (And yes I have the ST7735 library installed)

This works with me:

..
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);

ldar2020:
error: 'ST7735 does not name a type

Is the file that declares the type ST7735 included, directly or indirectly, in your sketch file?

Is the file that declares the type ST7735 included, directly or indirectly, in your sketch file?

After directly including it in the sketch, I am getting this error: expected class-name before '{' token

and this is highlighted: class Adafruit_ST7735 : public Adafruit_GFX {

You are using private functions in your code, do not do it
ie:

tft.writecommand(ST7735_DISPON);

Do fix all your:
tft.width
tft.height

shall be:
tft.width() - a fuction, not a variable
tft.height() - a function, not a variable

Now I am getting errors regarding the Robot_Control library.

C:\Program Files (86)\Arduino\libraries\Robot_Control\ArduinoRobot.cpp: In constructor 'RobotControl::RobotControl()':

it says that LCD_CS, DC_LCD, RST_LCD, MUXA, MUXB, MUXC, MUXD, MUX_IN, BUZZ, and Serial1 were not declared in this scope. (In member function 'void RobotControl::begin()':

That suggests there's something wrong with that library. Perhaps it hasn't been updated for the Arduino 1.0 IDE? Otherwise all I can suggest is to follow those errors and see what is causing them. For example, if that library refers to some other library then your sketch would need to include both libraries in order to build correctly - even if your sketch does not explicitly access the other library.

My program does not include the robot_control library

ldar2020:
My program does not include the robot_control library

Well, it must do one way or another, or else it would not be included in the compilation.

Ok. Think I am getting closer...Here is the new error in the robot_control file.

#include "ArduinoRobot.h"
#include "Multiplexer.h"
#include "Wire.h"
#include "EasyTransfer2.h"

//RobotControl::RobotControl(){}  //I tried to uncomment this but the same results

RobotControl::RobotControl():Arduino_LCD(LCD_CS,DC_LCD,RST_LCD){               //RobotControl is not declared here

}

void RobotControl::begin(){
	Wire.begin();
	//Compass
	//nothing here
		
	//TK sensors
	uint8_t MuxPins[]={MUXA,MUXB,MUXC,MUXD};
	Multiplexer::begin(MuxPins,MUX_IN,4);
	
	//piezo
	pinMode(BUZZ,OUTPUT);
	
	//communication
	Serial1.begin(9600);
	messageOut.begin(&Serial1);
	messageIn.begin(&Serial1);
	
	//TFT initialization
	//Arduino_LCD::initR(INITR_GREENTAB);
}

void RobotControl::setMode(uint8_t mode){
	messageOut.writeByte(COMMAND_SWITCH_MODE);
	messageOut.writeByte(mode);
	messageOut.sendData();
}


RobotControl Robot=RobotControl();

it says that RobotControl is not declared.

How do I fix this?

In which file is the RobotControl class declared? The declaration would consist of something similar to this:

...
class RobotControl
{
...

Where can I find this? The robot_control library is filled with tons of files.

Hopefully in one of those files. Any good code editor will have a 'find in files' option. And yeah, I know the Arduino IDE doesn't.