I found the solution: if I #include all tabs in the main tab in the right order and the one with the structs is alphabetically before the others then it will work
Posts made by FlorianB
-
RE: Problems with using struct and enum in another tab
-
Problems with using struct and enum in another tab
Hi I am using multiple tabs to make a big project more readable. Now i wanted one tab just to define structs and enums and get them out of the way.
The problem is that e.g. in tab#2 i can't use these data structures because they were "not declared in this scope". So I included the tabs using something like
#include "./tabWithEnums"This works fine until I want to use the same structs in a third tab. If I don't include the defining tab, then I get the upper error. If I include the defining tab in tab#3 then I get the error "redeclaration of ...".
Running out of ideas, I put the structs and enums in the main tab - same result.
May last idea was to define for example an enum with ON/OFF as values in every tab where I need them. Then I get the error "redeclaration" too.
So i can't declare it twice because the IDE complains about double declaration but at the same time I can't use the correct declaration in the other tab. I am getting mad here.I reduced the example code to this:
TAB1:
#include "./tab2.h" enum { off, on }; void setup() { Serial.begin(9600); Serial.println(); } void loop() { something(); delay(10000); }
TAB2:
void something () { Serial.println (on); }
result:
exit status 1
'on' was not declared in this scopeplease help. I lost several hours on this and I don't want to go back and put all code in one TAB. Btw. I know how to use variables over various tabs (using "extern") and methods (by declaring them from the calling tab) but both doesn't help me. Just so you know that I really tried.
thank you
-
RE: ESP32 with a capacitive sensor
@salmanfaris best if you could point me to an example that works as described: getting different values depending on hoe close the finger is without really touching. nothing i tried did work yet
-
RE: ESP32 with a capacitive sensor
@salmanfaris I haven't found a good sensor module for this at all. I used a thing which was calles touch sensor and it returns only 1/0. Tried to use touchRead() but it is not sensitive apparently, only 40 and 1 more or less.
#define touch_pin_numer 33
const int VALUE_THRESHOLD = 30;
int TOUCH_SENSOR_VALUE;
void setup()
{
Serial.begin(115200);
delay(1000);}
void loop(){
TOUCH_SENSOR_VALUE = touchRead(touch_pin_numer);
Serial.println(TOUCH_SENSOR_VALUE);
if(TOUCH_SENSOR_VALUE < VALUE_THRESHOLD)
{
Serial.println ("Touch ON");
}
else{
Serial.println ("Touch OFF");
}
}should show something between 40 (current max) and 1 (current min) the closer the finger gets but it shows 40/41/39 and 1 - nothing inbetween. got this code from the web
-
ESP32 with a capacitive sensor
Hi! I am trying to add an capacitive sensor to the ESP32, that will work through glass with 3mm thickness and an distance of 8 to 2 cm. I have bought sensors which only work on touch, i have looked into the touchRead() function but cant get a steady value increase/decrease with distance and only a real touch gets me enough difference to count it as a "touch". I have checked Arduino examples with foil where a resistor can set the sensitivity but nothing worked on my ESP32. i have spent hours looking for an example, can somebody point me to one please?
-
RE: Looking for PCB designer
Hi @Akhil and @Suhailjr . I already found someone but let's keep in touch please. Never know what happens...
-
Looking for PCB designer
Hi. I am looking for someone to design me a PCB (maybe several this year) which then I can have manufactured in small quantities or maybe this someone can do that too. It's mostly the ESP32 and a GPS or some sensors, USB connector for powering it up etc.
I need someone who could do that and a general price range please. Thank you