'TouchScreen' does not name a type
- Войдите на сайт для отправки комментариев
Втр, 23/09/2014 - 22:47
Здравствуйте, написал программку, но при проверкке и компиляции выскакивают следующие ошибки:
vibrocli_15:33: error: 'TouchScreen' does not name a type
vibrocli_15.ino: In function 'void setup()':
vibrocli_15:99: error: 'printf_begin' was not declared in this scope
vibrocli_15.ino: In function 'void loop()':
vibrocli_15:126: error: 'Point' was not declared in this scope
vibrocli_15:126: error: expected `;' before 'p'
vibrocli_15:129: error: 'p' was not declared in this scope
Вот сама прога:
#include <SPI.h> #include <digitalWriteFast.h> #include <iBoardRF24.h> #include <printf.h> #include <Adafruit_GFX.h> // Core graphics library #include <SWTFT.h> // Hardware-specific library #include <TouchScreen.h> #define YP A1 // must be an analog pin, use "An" notation! #define XM A2 // must be an analog pin, use "An" notation! #define YM 7 // can be a digital pin #define XP 6 // can be a digital pin #define TS_MINX 150 #define TS_MINY 120 #define TS_MAXX 920 #define TS_MAXY 940 #define BOXSIZE 40 #define PENRADIUS 3 #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF SWTFT tft; TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300); iBoardRF24 radio(18,20,19,16,17,21); //iBoardRF24(cepin, cspin, mosi_pin, miso_pin, sck_pin, irq_pin): const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL }; typedef struct{ unsigned long ms; unsigned long avgvalues; unsigned long nchanges; // unsigned long nscan; unsigned long n; } RFMsg; typedef struct{ unsigned int y; int value; } GPoint; unsigned long testTriangles(); unsigned long prevMicro=0; unsigned long prevN=0; unsigned long currentMillis; unsigned long textInterval = 1000; unsigned long prevtextMills = 0; unsigned long statsec_N=0; unsigned long statsec_SumVal=0; unsigned long statsec_NAct=0; unsigned long stat_MaxNValues=0; unsigned long stat_scrMaxNValues=0; unsigned long stat_avgCnt=0; int w = 0; int h = 0; float curpos = 0; float prevpos = 0; unsigned long maxvalue = 1024; float ko = 0; unsigned int topline = 1; unsigned int bottomline = 15; int viewType = 2; //GPoint scr[320]; void DrawCountAmp(RFMsg msg); void DrawG(int y); void DrawAmpOnly(RFMsg msg,int ystart,int ystop); void DrawCountOnly(RFMsg msg,int ystart,int ystop); void setup(void) { tft.reset(); uint16_t identifier = tft.readID(); tft.begin(identifier); tft.setRotation(3); w = tft.width(), h = tft.height(); delay(100); Serial.begin(57600); delay(100); printf_begin(); printf("\n\rRF24/examples/GettingStarted/\n\r"); delay(100); printf("*** \n\r"); radio.begin(); // optionally, increase the delay between retries & # of retries radio.setRetries(15,15); // optionally, reduce the payload size. seems to // improve reliability radio.setPayloadSize(sizeof(RFMsg)); radio.openWritingPipe(pipes[1]); radio.openReadingPipe(1,pipes[0]); radio.startListening(); radio.printDetails(); //radio.setAutoAck(false); //testTriangles(); tft.fillScreen(BLACK); unsigned long start = micros(); ko = ((float)h-(float)bottomline) / (float)maxvalue; } void loop(void) { Point p = ts.getPoint(); pinMode(XM, OUTPUT); pinMode(YP, OUTPUT); if (p.z>0) { viewType++; if (viewType>2) viewType=0; tft.fillScreen(BLACK); curpos=0; delay(200); } if ( radio.available() ) { // Dump the payloads until we've gotten everything RFMsg msg; bool done = false; //1 мксек= 1 / 1 000 000 сек while (!done) { currentMillis = micros(); // Fetch the payload, and see if this was the last one. done = radio.read( &msg, sizeof(RFMsg) ); //curpos++; curpos = curpos + (float)msg.ms / 100000; if (curpos>=w) { curpos=0; if (stat_scrMaxNValues>stat_MaxNValues*2) { stat_scrMaxNValues=stat_MaxNValues+(stat_MaxNValues%4); } stat_MaxNValues=0; //stat_MaxNValues = stat_AllMaxNValues; //tft.drawLine(curpos, h-bottomline, curpos, 0, BLUE); } if (msg.nchanges>stat_MaxNValues) { stat_MaxNValues = msg.nchanges; } if (currentMillis - prevtextMills > textInterval*1000) { tft.drawFastVLine(curpos, topline, h-topline-bottomline, 0x0007); } if (viewType==0) { DrawAmpOnly(msg, topline,h-bottomline); } if (viewType==1) { DrawCountOnly(msg, topline,h-bottomline); } if (viewType==2) { int seredina = (h-topline-bottomline)/2; DrawAmpOnly(msg, topline,seredina); DrawCountOnly(msg, seredina+1,h-bottomline); } statsec_N++; statsec_SumVal=statsec_SumVal+msg.avgvalues; statsec_NAct=statsec_NAct+msg.nchanges; //stat_MaxNValues=statsec_NAct+msg.nchanges; if (currentMillis - prevtextMills > textInterval*1000) { tft.setCursor(10, h-bottomline+4); if ( msg.n-prevN>1 ) { tft.fillRect(0, h-bottomline, w, bottomline, MAGENTA); tft.print("E:"); tft.print(msg.n-prevN); tft.print(" "); } else { tft.fillRect(0, h-bottomline, w, bottomline, BLUE); } tft.setTextColor(WHITE); tft.setTextSize(1); tft.print("INT:"); tft.setTextColor(YELLOW); tft.print(msg.ms); tft.setTextColor(WHITE); tft.print(" VAL:"); tft.setTextColor(YELLOW); tft.print(msg.avgvalues); tft.setTextColor(WHITE); tft.print(" CNT:"); tft.setTextColor(YELLOW); tft.print(statsec_NAct%statsec_N); tft.setTextColor(WHITE); tft.print(" MAX:"); tft.setTextColor(YELLOW); tft.print(stat_MaxNValues); /* tft.print(" Y:"); tft.print(p.y); tft.print(" X:"); tft.print(p.x); tft.print(" Z:"); tft.print(p.z); */ prevtextMills = currentMillis; statsec_N=0; statsec_SumVal=0; statsec_NAct=0; } prevpos = curpos; prevN = msg.n; //tft.drawLine(curpos+1, h-bottomline, curpos+1, 0, BLUE); //tft.drawLine(curpos, h-bottomline, curpos, y, YELLOW); //printf("MS:%lu RV: %i Y:%f KO:%f H:%i MAX:%i",msg.ms,msg.value,y,h / maxvalue,h,maxvalue); //printf("\n\r"); } //radio.stopListening(); // Send the final one back. //radio.write( &got_time, sizeof(unsigned long) ); //printf("Sent response.\n\r"); //radio.startListening(); } } unsigned long testTriangles() { unsigned long start; int n, i, cx = tft.width() / 2 - 1, cy = tft.height() / 2 - 1; tft.fillScreen(BLACK); n = min(cx, cy); start = micros(); for(i=0; i<n; i+=5) { tft.drawTriangle( cx , cy - i, // peak cx - i, cy + i, // bottom left cx + i, cy + i, // bottom right tft.color565(0, 0, i)); } return micros() - start; } void DrawAmpOnly(RFMsg msg,int ystart,int ystop) { float ko = ((float)ystop-(float)ystart) / (float)maxvalue; float y = msg.avgvalues * ko; //(float)(msg.value * ko); int he = ystop-ystart; DrawCursor(ystart,ystop); tft.drawFastVLine(curpos, ystart+(he-y), y, GREEN); } void DrawCountOnly(RFMsg msg,int ystart,int ystop) { int he = ystop-ystart; if (msg.nchanges>stat_scrMaxNValues) { stat_scrMaxNValues = msg.nchanges+ (msg.nchanges%3); tft.drawFastVLine(curpos-1, ystart, he, YELLOW); } float ko = ((float)ystop-(float)ystart) / (float)stat_scrMaxNValues; float y = msg.nchanges * ko; //(float)(msg.value * ko); DrawCursor(ystart,ystop); tft.drawFastVLine(curpos, ystart+(he-y), y, RED); } void DrawCursor(int ystart,int ystop) { int he = ystop-ystart; tft.drawFastVLine(curpos+1, ystart, he, BLACK); tft.drawFastVLine(curpos+2, ystart, he, MAGENTA); tft.drawFastVLine(curpos+3, ystart, he, BLACK); }
Надеюсь кто-нибудь поможет разобраться с ошибками, заранее спасибо!
Протирая хрустальный шар, тихо напевает песню про зайцев.
так все ж написано черным по белому, на старом добром англицком, том самом, который известен каждому второму китайцу! :)
error: 'TouchScreen' does not name a type
судя по всему в файлике
TouchScreen.h
идет определение типов, среда его не видит и ругается. сprintf.h
такая же фигня. могу предположить, что не туда скопировали хидеры. если вообще копировали.а если с английским вообще никак, то тут где-то в соседней ветке какой-то патриот раздаёт иде с русским хелпом, вам к нему
Ну вы уважаемый можете протирать свои шары сколько угодно, а за сарказмом или шутками я мог бы обратиться в другое место. Если вам что-то непонятно, или я выразил проблемы нечетко, так вы укажите на это, а поерничать или пошутить я и сам могу с превеликим удовольствием.
С уважением
Ну во-первых я не каждый второй китаец, и даже не первый, да и в конце концов к расе желтолицых никак по родословной не отношусь :-)
А во-вторых за подсказку что на что ругается спасибо, буду исправлять,
Ну во-первых я не каждый второй китаец, и даже не первый, да и в конце концов к расе желтолицых никак по родословной не отношусь :-)
А во-вторых за подсказку что на что ругается спасибо, буду исправлять,
Тоесть было не очевидно что на что-то ругается? Круто.
да ты зря на новичков не гони! видишь, есть уважительная причина - товарищ ни разу не китаец, поэтому английский может смело игнорировать
да ты зря на новичков не гони! видишь, есть уважительная причина - товарищ ни разу не китаец, поэтому английский может смело игнорировать
Да как то упустил я это. Буду ждать второго китайца новичка.
У меня такая же ошибка! Ты не решил проблему с ней?
У меня такая же ошибка! Ты не решил проблему с ней?
Тоесть обьяснения вы сразу пропустили. Прально. Какого фига не выложили пошаговое решение проблемы.