En nu heb ik deze gevonden:
https://thesolaruniverse.wordpress.com/2021/06/01/esp32-wroom-32-and-u…
En sketch:
code:
// https://thesolaruniverse.wordpress.com/2021/06/01/esp32-wroom-32-and-u…
// ESP32_parallel_Uno_TFT_shield_radar_scope
// Board ESP32 Dev Module
// microcontroller ESP32-WROOM32
// display: Uno TFT shield 320*480 ILI9341 controller
// on ESP32 bench - only 5V jumper or 3V3 and 5V jumpers
// June 1, 2021
// original edited by Floris Wouterlood
// public domain
#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI(); // invoke custom library
// don't forget to update User_Setup.h
// some principal color definitions
// RGB 565 color picker at https://ee-programming-notepad.blogspot.com/2016/10/16-bit-color-gener…
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define GREY 0x2108
#define TEXT_COLOR 0xFFFF
#define SCOPE 0x3206 // custom scope CRT color
// center coordinates
// for screens bigger than 240x320 only change these two x-y coordinates
int center_x=120; // center x of radar scope on 240x320 TFT display
int center_y=160; // center y of radar scope on 240x320 TFT display
float edge_x =(center_x);
float edge_y =(center_y);
float edge_x_old = 0; // remembers previous edge x coordinate
float edge_y_old = 0; // remembers previous edge y coordinate
float edge_x_out = 0;
float edge_y_out = 0;
float angle = 0;
int j;
int radius = 110; // beam length - for 320x240 TFT screens
int scope_x = 0;
int scope_y = 0;
int sweepTime = 25;
int frametime = 250;
void setup() {
Serial.begin (9600);
Serial.println ();
Serial.println ();
Serial.println ("starting radar scope . .");
tft.init(); // initialize display
tft.setRotation (2); // set to landscape
tft.fillScreen (BLACK);
tft.setCursor (10, 10);
tft.setTextColor (WHITE);
tft.setTextSize (1);
Serial.println ("ESP32-WROOM32 and parallel interface TFT ILI9341");
Serial.println ("starting up......");
tft.println("radar scope initializing ......");
delay (1000);
tft.fillScreen (BLACK);
build_scope ();
}
void loop(void){
for (j=0;j<360;j++)
{
angle = (j*0.01745331); // angle expressed in radians - 1 degree = 0,01745331 radians
edge_coord (); // calculate beam
sweep_beam ();
tft.fillCircle (center_x,center_y,2,GREEN); // restore centerpoint
delay (sweepTime);
}
}
void build_scope (){
tft.drawRect (center_x-120, center_y-155, 254, 310, RED); // main contour
tft.drawRect (center_x-12, center_y-160, 30,11, RED); // edge decoration
tft.drawRect (center_x-12, center_y+150, 30,11, RED); // edge decoration
scope_x = (center_x+100); scope_y=(center_y-110); // right upper screw
screw ();
scope_x = (center_x-100); scope_y=(center_y-110); // left upper screw
screw ();
scope_x = (center_x-100); scope_y=(center_y+120); // left lower screw
screw ();
scope_x = (center_x+100); scope_y=(center_y+120); // right lower screw
screw ();
tft.drawCircle (center_x,center_y, (radius+1),RED); // scope CRT
tft.drawCircle (center_x,center_y, (radius+2),RED);
tft.fillCircle (center_x,center_y, radius,SCOPE);
tft.fillCircle (center_x,center_y, radius,SCOPE);
tft.fillCircle (center_x,center_y, 2,GREEN);
tft.drawCircle (center_x,center_y,60,GREEN);
tft.drawCircle (center_x,center_y,90,GREEN);
draw_scale ();
angle=0;
}
void edge_coord (){ // calculate beam tip coordinates and remember previous tip coordinates
edge_x_old = edge_x;
edge_y_old = edge_y;
edge_x = (center_x+(radius*cos(angle)));
edge_y = (center_y+(radius*sin(angle)));
}
void sweep_beam (){ // refresh beam by drawing and overdrawing old with scope color
tft.drawLine (center_x,center_y,edge_x_old,edge_y_old,SCOPE); // draw previous beam with scope color
tft.drawLine (center_x,center_y,edge_x,edge_y,GREEN);
}
void screw (){ // draw screw
tft.drawCircle (scope_x,scope_y, 6,RED);
tft.drawLine ((scope_x-11),scope_y,(scope_x+11),(scope_y),RED);
tft.drawLine (scope_x,(scope_y-11),scope_x,(scope_y+11),RED);
}
void draw_scale (){ // draw scale marker line segments on scope edge
j=0;
do {
angle = (j*0.01745331); // angle is expressed in radians - 1 degree = 0,01745331 radians
edge_x = (center_x + (radius*cos(angle)));
edge_y = (center_y + (radius*sin(angle)));
edge_x_out = (center_x + ((radius+8)*cos(angle)));
edge_y_out = (center_y + ((radius+8)*sin(angle)));
tft.drawLine (edge_x,edge_y, edge_x_out, edge_y_out,RED);
j = j+10;
} while (j<360);
}
Maar krijg deze foutmelgingen
Arduino: 1.8.18 (Windows 8.1), Board:"ESP32-WROOM-DA Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"
In file included from C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.h:100,
from C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:16:
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c: In function 'void dc_callback(spi_transaction_t*)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: 'GPIO' was not declared in this scope
189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:760:28: note: in expansion of macro 'DC_D'
760 | if ((bool)spi_tx->user) {DC_D;}
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:761:9: note: in expansion of macro 'DC_C'
761 | else {DC_C;}
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_write()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope
233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:80:5: note: in expansion of macro 'CS_L'
80 | CS_L;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::begin_nin_write()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope
233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:92:5: note: in expansion of macro 'CS_L'
92 | CS_L;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_write()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope
234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:106:7: note: in expansion of macro 'CS_H'
106 | CS_H;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::end_nin_write()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope
234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:121:7: note: in expansion of macro 'CS_H'
121 | CS_H;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_read()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope
233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:141:5: note: in expansion of macro 'CS_L'
141 | CS_L;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_read()':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope
234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:161:7: note: in expansion of macro 'CS_H'
161 | CS_H;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::writecommand(uint8_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:964:3: note: in expansion of macro 'DC_C'
964 | DC_C;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::writedata(uint8_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: 'GPIO' was not declared in this scope
189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1012:3: note: in expansion of macro 'DC_D'
1012 | DC_D; // Play safe, but should already be in data mode
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'uint8_t TFT_eSPI::readcommand8(uint8_t, uint8_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1049:3: note: in expansion of macro 'DC_C'
1049 | DC_C; tft_Write_8(0xD9);
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual uint16_t TFT_eSPI::readPixel(int32_t, int32_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope
234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1205:3: note: in expansion of macro 'CS_H'
1205 | CS_H;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::readRectRGB(int32_t, int32_t, int32_t, int32_t, uint8_t*)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope
234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:2209:3: note: in expansion of macro 'CS_H'
2209 | CS_H;
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::setWindow(int32_t, int32_t, int32_t, int32_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3419:5: note: in expansion of macro 'DC_C'
3419 | DC_C; tft_Write_8(TFT_CASET);
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::readAddrWindow(int32_t, int32_t, int32_t, int32_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3495:3: note: in expansion of macro 'DC_C'
3495 | DC_C; tft_Write_8(TFT_CASET);
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::drawPixel(int32_t, int32_t, uint32_t)':
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3677:7: note: in expansion of macro 'DC_C'
3677 | DC_C; tft_Write_8(TFT_CASET);
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3684:7: note: in expansion of macro 'DC_C'
3684 | DC_C; tft_Write_8(TFT_PASET);
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope
188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
| ^~~~
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3690:3: note: in expansion of macro 'DC_C'
3690 | DC_C; tft_Write_8(TFT_RAMWR);
| ^~~~
exit status 1
Fout bij het compileren voor board ESP32-WROOM-DA Module
Een beetje verder maar hoe kan ik de foutmeldingen oplossen?