I am working with the Camera server and would like to print some data to the serial monitor. Specifically I would like to transfer the x,y coordinates of the bounding box around a face.
when I insert a Serial.println statement I get an error stating that “Serial” is not declared in this scope. Is there a way to serial print from the camera server or can data be passed to the main loop where Serial is declared?
Thanks John
Hi.
Did you initialize Serial communication using:
Serial.begin(115200);
Regards,
Sara
Hi Sara
Yes I have Serial.begin. I’m using the code as downloaded from your website. The streaming service, Face ID etc is all working.
My first attempt was to insert a Serial.print statement at line 230 of app_httpd.cpp.
That returned the error that “‘Serial’ was not declared in this scope”
The second thing I tried was to declare an int variable ‘xpos up front in CameraWebServer.ino and then assigned it the value of x at line 230 of app_httpd.cpp. That returned the same error “xpos was not declared in this scope.
I can Serial.print a message in loop()
Thanks for any help
John
Hi.
You need to include:
#include <Arduino.h>
at the top of the app_httpd.cpp file.
Then, call:
Serial.begin(115200);
Serial.print("TEXT YOU WANT TO PRINT");
To use variables across files, read this discussion:
https://forum.arduino.cc/t/passing-variable-froma-cpp-file/465076/2
I hope this helps.
Regards,
Sara