Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot upload the code. Error: ".... was not declared in this scope" #41

Open
looongtom opened this issue Oct 29, 2023 · 0 comments
Open

Comments

@looongtom
Copy link

looongtom commented Oct 29, 2023

I cannot upload the code to my Arduino esp 8266 Wemos D1 R2. It showed error that many variables which was not declared in this scope. The details below:

D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In constructor 'Adafruit_ST7735_mod::Adafruit_ST7735_mod(int8_t, int8_t, int8_t, int8_t, int8_t)':
Adafruit_ST7735_mod.cpp:47:3: error: '_cs' was not declared in this scope; did you mean 'cs'?
47 | _cs = cs;
| ^~~
| cs
Adafruit_ST7735_mod.cpp:48:3: error: '_rs' was not declared in this scope; did you mean 'rs'?
48 | _rs = rs;
| ^~~
| rs
Adafruit_ST7735_mod.cpp:49:3: error: '_sid' was not declared in this scope; did you mean 'sid'?
49 | _sid = sid;
| ^~~~
| sid
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\LiveOV7670.ino: In function 'void setup()':
LiveOV7670:14:3: error: 'CLKPR' was not declared in this scope
14 | CLKPR = 0x80; // enter clock rate change mode
| ^~~~~
Adafruit_ST7735_mod.cpp:50:3: error: '_sclk' was not declared in this scope; did you mean 'sclk'?
50 | _sclk = sclk;
| ^~~~~
| sclk
Adafruit_ST7735_mod.cpp:51:3: error: '_rst' was not declared in this scope; did you mean 'rst'?
51 | _rst = rst;
| ^~~~
| rst
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In constructor 'Adafruit_ST7735_mod::Adafruit_ST7735_mod(int8_t, int8_t, int8_t)':
Adafruit_ST7735_mod.cpp:60:3: error: '_cs' was not declared in this scope; did you mean 'cs'?
60 | _cs = cs;
| ^~~
| cs
Adafruit_ST7735_mod.cpp:61:3: error: '_rs' was not declared in this scope; did you mean 'rs'?
61 | _rs = rs;
| ^~~
| rs
Adafruit_ST7735_mod.cpp:62:3: error: '_rst' was not declared in this scope; did you mean 'rst'?
62 | _rst = rst;
| ^~~~
| rst
Adafruit_ST7735_mod.cpp:64:3: error: '_sid' was not declared in this scope
64 | _sid = _sclk = 0;
| ^~~~
Adafruit_ST7735_mod.cpp:64:11: error: '_sclk' was not declared in this scope
64 | _sid = _sclk = 0;
| ^~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::spiwrite(uint8_t)':
Adafruit_ST7735_mod.cpp:93:20: error: 'dataport' was not declared in this scope
93 | if(c & bit) *dataport |= datapinmask;
| ^~~~~~~~
In file included from D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp:9:
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h: In member function 'void CameraOV7670::waitForVsync()':
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:218:10: error: 'OV7670_VSYNC' was not declared in this scope
218 | while(!OV7670_VSYNC);
| ^~~~~~~~~~~~
Adafruit_ST7735_mod.cpp:93:33: error: 'datapinmask' was not declared in this scope
93 | if(c & bit) *dataport |= datapinmask;
| ^~~~~~~~~~~
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h: In member function 'void CameraOV7670::waitForPixelClockLow()':
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:227:9: error: 'OV7670_PIXEL_CLOCK' was not declared in this scope
227 | while(OV7670_PIXEL_CLOCK);
| ^~~~~~~~~~~~~~~~~~
Adafruit_ST7735_mod.cpp:94:20: error: 'dataport' was not declared in this scope
94 | else *dataport &= ~datapinmask;
| ^~~~~~~~
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h: In member function 'void CameraOV7670::waitForPixelClockHigh()':
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:231:10: error: 'OV7670_PIXEL_CLOCK' was not declared in this scope
231 | while(!OV7670_PIXEL_CLOCK);
| ^~~~~~~~~~~~~~~~~~
Adafruit_ST7735_mod.cpp:94:33: error: 'datapinmask' was not declared in this scope
94 | else *dataport &= ~datapinmask;
| ^~~~~~~~~~~
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h: In member function 'void CameraOV7670::ignoreHorizontalPaddingRight()':
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:250:9: error: 'OV7670_PIXEL_CLOCK' was not declared in this scope
250 | while(OV7670_PIXEL_CLOCK) pixelTime++;
| ^~~~~~~~~~~~~~~~~~
Adafruit_ST7735_mod.cpp:95:8: error: 'clkport' was not declared in this scope
95 | *clkport |= clkpinmask;
| ^~~~~~~
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:251:10: error: 'OV7670_PIXEL_CLOCK' was not declared in this scope
251 | while(!OV7670_PIXEL_CLOCK) pixelTime++;
| ^~~~~~~~~~~~~~~~~~
Adafruit_ST7735_mod.cpp:95:20: error: 'clkpinmask' was not declared in this scope
95 | *clkport |= clkpinmask;
| ^~~~~~~~~~
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h: In member function 'void CameraOV7670::readPixelByte(uint8_t&)':
C:\Users\trinh\OneDrive\Documents\Arduino\libraries\LiveOV7670Library/CameraOV7670.h:256:3: error: 'OV7670_READ_PIXEL_BYTE' was not declared in this scope
256 | OV7670_READ_PIXEL_BYTE(byte);
| ^~~~~~~~~~~~~~~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::writecommand(uint8_t)':
Adafruit_ST7735_mod.cpp:112:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
112 | *rsport &= ~rspinmask;
| ^~~~~~
| ushort
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void sendBlankFrame(uint16_t)':
ExampleUart.cpp:310:7: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
310 | UDR0 = formatRgbPixelByteH(colorH);
| ^~~~
| D0
Adafruit_ST7735_mod.cpp:112:15: error: 'rspinmask' was not declared in this scope
112 | *rsport &= ~rspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void processNextGrayscalePixelByteInBuffer()':
ExampleUart.cpp:379:5: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
379 | UDR0 = *lineBufferSendByte;
| ^~~~
| D0
Adafruit_ST7735_mod.cpp:113:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
113 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void processGrayscaleFrameDirect()':
ExampleUart.cpp:402:7: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
402 | UDR0 = lineBuffer[0];
| ^~~~
| D0
Adafruit_ST7735_mod.cpp:113:15: error: 'cspinmask' was not declared in this scope
113 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void tryToSendNextRgbPixelByteInBuffer()':
ExampleUart.cpp:481:5: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
481 | UDR0 = *lineBufferSendByte;
| ^~~~
| D0
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void processRgbFrameDirect()':
ExampleUart.cpp:515:7: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
515 | UDR0 = lineBuffer[0];
| ^~~~
| D0
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::writedata(uint8_t)':
Adafruit_ST7735_mod.cpp:129:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
129 | *rsport |= rspinmask;
| ^~~~~~
| ushort
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void commandStartNewFrame(uint8_t)':
ExampleUart.cpp:564:3: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
564 | UDR0 = 0x00; // New command
| ^~~~
| D0
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'void commandDebugPrint(String)':
ExampleUart.cpp:587:5: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
587 | UDR0 = 0x00; // New commnad
| ^~~~
| D0
Adafruit_ST7735_mod.cpp:129:15: error: 'rspinmask' was not declared in this scope
129 | *rsport |= rspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'uint8_t sendNextCommandByte(uint8_t, uint8_t)':
ExampleUart.cpp:606:3: error: 'UDR0' was not declared in this scope; did you mean 'D0'?
606 | UDR0 = commandByte;
| ^~~~
| D0
Adafruit_ST7735_mod.cpp:130:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
130 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\ExampleUart.cpp: In function 'bool isUartReady()':
ExampleUart.cpp:619:10: error: 'UCSR0A' was not declared in this scope
619 | return UCSR0A & (1<<UDRE0);
| ^~~~~~
ExampleUart.cpp:619:23: error: 'UDRE0' was not declared in this scope
619 | return UCSR0A & (1<<UDRE0);
| ^~~~~
Adafruit_ST7735_mod.cpp:130:15: error: 'cspinmask' was not declared in this scope
130 | csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::commonInit(const uint8_t
)':
Adafruit_ST7735_mod.cpp:316:3: error: 'colstart' was not declared in this scope
316 | colstart = rowstart = 0; // May be overridden in init func
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:316:15: error: 'rowstart' was not declared in this scope
316 | colstart = rowstart = 0; // May be overridden in init func
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:318:11: error: '_rs' was not declared in this scope
318 | pinMode(_rs, OUTPUT);
| ^~~
Adafruit_ST7735_mod.cpp:319:11: error: '_cs' was not declared in this scope
319 | pinMode(_cs, OUTPUT);
| ^~~
Adafruit_ST7735_mod.cpp:320:3: error: 'csport' was not declared in this scope; did you mean 'ushort'?
320 | csport = portOutputRegister(digitalPinToPort(_cs));
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:321:3: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
321 | rsport = portOutputRegister(digitalPinToPort(_rs));
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:322:3: error: 'cspinmask' was not declared in this scope
322 | cspinmask = digitalPinToBitMask(_cs);
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:323:3: error: 'rspinmask' was not declared in this scope
323 | rspinmask = digitalPinToBitMask(_rs);
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:343:13: error: '_sclk' was not declared in this scope
343 | pinMode(_sclk, OUTPUT);
| ^~~~~
Adafruit_ST7735_mod.cpp:344:13: error: '_sid' was not declared in this scope
344 | pinMode(_sid , OUTPUT);
| ^~~~
Adafruit_ST7735_mod.cpp:345:5: error: 'clkport' was not declared in this scope
345 | clkport = portOutputRegister(digitalPinToPort(_sclk));
| ^~~~~~~
Adafruit_ST7735_mod.cpp:346:5: error: 'dataport' was not declared in this scope
346 | dataport = portOutputRegister(digitalPinToPort(_sid));
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:347:5: error: 'clkpinmask' was not declared in this scope
347 | clkpinmask = digitalPinToBitMask(_sclk);
| ^~~~~~~~~~
Adafruit_ST7735_mod.cpp:348:5: error: 'datapinmask' was not declared in this scope
348 | datapinmask = digitalPinToBitMask(_sid);
| ^~~~~~~~~~~
Adafruit_ST7735_mod.cpp:355:7: error: '_rst' was not declared in this scope
355 | if (_rst) {
| ^~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::initR(uint8_t)':
Adafruit_ST7735_mod.cpp:380:5: error: 'colstart' was not declared in this scope
380 | colstart = 2;
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:381:5: error: 'rowstart' was not declared in this scope
381 | rowstart = 1;
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:385:5: error: 'colstart' was not declared in this scope
385 | colstart = 2;
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:386:5: error: 'rowstart' was not declared in this scope
386 | rowstart = 3;
| ^~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::setAddrWindow(uint8_t, uint8_t, uint8_t, uint8_t)':
Adafruit_ST7735_mod.cpp:407:16: error: 'colstart' was not declared in this scope
407 | writedata(x0+colstart); // XSTART
| ^~~~~~~~
Adafruit_ST7735_mod.cpp:413:16: error: 'rowstart' was not declared in this scope
413 | writedata(y0+rowstart); // YSTART
| ^~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::startAddrWindow(uint8_t, uint8_t, uint8_t, uint8_t)':
Adafruit_ST7735_mod.cpp:426:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
426 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:426:15: error: 'rspinmask' was not declared in this scope
426 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:427:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
427 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:427:15: error: 'cspinmask' was not declared in this scope
427 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::endAddrWindow()':
Adafruit_ST7735_mod.cpp:432:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
432 | *csport |= cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:432:14: error: 'cspinmask' was not declared in this scope
432 | *csport |= cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'void Adafruit_ST7735_mod::pushColor(uint16_t)':
Adafruit_ST7735_mod.cpp:443:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
443 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:443:15: error: 'rspinmask' was not declared in this scope
443 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:444:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
444 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:444:15: error: 'cspinmask' was not declared in this scope
444 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'virtual void Adafruit_ST7735_mod::drawPixel(int16_t, int16_t, uint16_t)':
Adafruit_ST7735_mod.cpp:464:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
464 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:464:15: error: 'rspinmask' was not declared in this scope
464 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:465:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
465 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:465:15: error: 'cspinmask' was not declared in this scope
465 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'virtual void Adafruit_ST7735_mod::drawFastVLine(int16_t, int16_t, int16_t, uint16_t)':
Adafruit_ST7735_mod.cpp:490:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
490 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:490:15: error: 'rspinmask' was not declared in this scope
490 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:491:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
491 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:491:15: error: 'cspinmask' was not declared in this scope
491 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'virtual void Adafruit_ST7735_mod::drawFastHLine(int16_t, int16_t, int16_t, uint16_t)':
Adafruit_ST7735_mod.cpp:516:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
516 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:516:15: error: 'rspinmask' was not declared in this scope
516 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:517:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
517 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:517:15: error: 'cspinmask' was not declared in this scope
517 | *csport &= ~cspinmask;
| ^~~~~~~~~
D:\IOT\LiveOV7670-master\LiveOV7670-master\src\LiveOV7670\Adafruit_ST7735_mod.cpp: In member function 'virtual void Adafruit_ST7735_mod::fillRect(int16_t, int16_t, int16_t, int16_t, uint16_t)':
Adafruit_ST7735_mod.cpp:552:4: error: 'rsport' was not declared in this scope; did you mean 'ushort'?
552 | *rsport |= rspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:552:15: error: 'rspinmask' was not declared in this scope
552 | *rsport |= rspinmask;
| ^~~~~~~~~
Adafruit_ST7735_mod.cpp:553:4: error: 'csport' was not declared in this scope; did you mean 'ushort'?
553 | *csport &= ~cspinmask;
| ^~~~~~
| ushort
Adafruit_ST7735_mod.cpp:553:15: error: 'cspinmask' was not declared in this scope
553 | *csport &= ~cspinmask;
| ^~~~~~~~~
exit status 1
'_cs' was not declared in this scope; did you mean 'cs'?

@looongtom looongtom changed the title Cannot run the code. Error: ".... was not declared in this scope" Cannot upload the code. Error: ".... was not declared in this scope" Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant