I just want to know if you think you can update Zeus car by adding new features that’s exist physically. I notice there’s a flash light on ESP32-cam, I saw some forums to turn it ON in EZblock but is it possible to turn it ON with sunfounder controller? I found that camera image is dark even when the room’s lamps are all ON. And another question, if I want to customize sunfounder controller, where do I go to assign buttons\switch?
You can add the ability to control the led in the UNO code by simply calling the Aicamera function:
aiCam.lamp_on(5); // brightness level, 0~10
aiCam.lamp_off(); // brightness level, 0~10.
You can add the on/off control to the app (assuming it’s control number M) and then modify the onReceive() function in Zeus_Car.ino to add the control code:
if (aiCam.getSwitch(REGION_M) == true) {
Serial.println(“lamp on”);
aiCam.lamp_on(5); //turn on cam lamp, level 0 ~ 10
} else if (aiCam.getSwitch(REGION_M) == false) {
Serial.println(“lamp off”);
aiCam.lamp_off(); // turn off cam lamp
}
in which section should i add thoses commands?
for : aiCam.lamp_on(5); // brightness level, 0~10
aiCam.lamp_off(); // brightness level, 0~10
should i add it to ai_camera.cpp or .h and which lines, at the beginning, middle, end? Do i enter it straight like that?
I’m getting this error after checkout the code :
/home/david/Downloads/zeus-car-main/Zeus_Car/Zeus_Car.ino: In function ‘void onReceive()’:
Zeus_Car:555:23: error: ‘lamp’ was not declared in this scope
Serial.println(âlamp onâ);
^
Zeus_Car:556:11: error: ‘class AiCamera’ has no member named ‘lamp_on’
aiCam.lamp_on(5); //turn on cam lamp, level 0 ~ 10
^
Zeus_Car:558:23: error: ‘lamp’ was not declared in this scope
Serial.println(âlamp offâ);
^
Zeus_Car:559:11: error: ‘class AiCamera’ has no member named ‘lamp_off’
aiCam.lamp_off(); // turn off cam lamp
^
exit status 1
stray ‘\342’ in program
There’s photos of where I add codes
I’m sorry, I’m so newbie, even with ChatGPT, I’m turning in round. I really need a good book about coding, from newbie to pro…
What do you think about those instructions: Zeus Smart Car Kit: light and WiFi signal boost to explore the dark – Renzo Mischianti
Sorry, the lamp_on() function is not included in the aiCam class of Zeus Car, the correct code is located in another branch and that branch has separated ai_camera.h, ai_camera.cpp into a separate library. Anyway here is the correct way to do it:
- make sure the camera’s firmware version >= 1.3.0, the ESP32 firmware version will be printed when the code is run.
- refer to SunFounder_AI_Camera/src/SunFounder_AI_Camera.h at main · sunfounder/SunFounder_AI_Camera · GitHub .
and
SunFounder_AI_Camera/src/SunFounder_AI_Camera.cpp at main · sunfounder/SunFounder_AI_Camera · GitHub
Add lamp_on and lamp_off function definitions to ai_camera.h, ai_camera.cpp. - add in Zeus_Car.ino onRecive() function:
if (aiCam.getSwitch(REGION_C) == true) {
Serial.println(“lamp on”);
aiCam.lamp_on(5); //turn on cam lamp, level 0 ~ 10
} else if (aiCam.getSwitch(REGION_C) == false) {
Serial.println(“lamp off”);
aiCam.lamp_off(); // turn off cam lamp
}
Ok, thanks you for the photos, it’ll be easier for me to enter codes at the right place.
Another question, is it possible to change the switch for a rheostat(slider) to control the brightness from the app?
I’ve try what you told me and i got this error :
Arduino:1.8.19 (Linux), Carte : “Arduino Uno”
/home/david/Téléchargements/zeus-car-main/Zeus_Car/compass.cpp: In function ‘bool compassCalibrateLoop()’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/compass.cpp:115:5: warning: return-statement with no value, in function returning ‘bool’ [-fpermissive]
return;
^~~~~~
Zeus_Car:614:20: error: stray ‘\342’ in program
Serial.println(“lamp on”);
^
Zeus_Car:614:21: error: stray ‘\200’ in program
Serial.println(“lamp on”);
^
Zeus_Car:614:22: error: stray ‘\234’ in program
Serial.println(“lamp on”);
^
Zeus_Car:614:30: error: stray ‘\342’ in program
Serial.println(“lamp on”);
^
Zeus_Car:614:31: error: stray ‘\200’ in program
Serial.println(“lamp on”);
^
Zeus_Car:614:32: error: stray ‘\235’ in program
Serial.println(“lamp on”);
^
Zeus_Car:617:20: error: stray ‘\342’ in program
Serial.println(“lamp off”);
^
Zeus_Car:617:21: error: stray ‘\200’ in program
Serial.println(“lamp off”);
^
Zeus_Car:617:22: error: stray ‘\234’ in program
Serial.println(“lamp off”);
^
Zeus_Car:617:31: error: stray ‘\342’ in program
Serial.println(“lamp off”);
^
Zeus_Car:617:32: error: stray ‘\200’ in program
Serial.println(“lamp off”);
^
Zeus_Car:617:33: error: stray ‘\235’ in program
Serial.println(“lamp off”);
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp: In function ‘uint16_t _gsGetAngleOffset(byte)’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:102:51: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
if (indexOf(ANGLE_0_LIST, ANGLE_0_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:104:60: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
} else if (indexOf(ANGLE_45_LIST, ANGLE_45_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:106:60: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
} else if (indexOf(ANGLE_90_LIST, ANGLE_90_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:108:62: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
} else if (indexOf(ANGLE_N45_LIST, ANGLE_N45_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:114:53: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
if (indexOf(OFFSET_0_LIST, OFFSET_0_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:116:60: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
} else if (indexOf(OFFSET_1_LIST, OFFSET_1_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:118:62: warning: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
} else if (indexOf(OFFSET_N1_LIST, OFFSET_N1_SIZE, gsValues)){
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/grayscale.cpp:68:6: note: initializing argument 1 of ‘bool indexOf(byte*, byte, byte)’
bool indexOf(byte* arr, byte size, byte value) {
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/qmc6310.cpp: In member function ‘bool QMC6310::_i2cReadInto(byte, byte, byte*)’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/qmc6310.cpp:101:61: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
uint8_t rec_len = Wire.requestFrom(QMC6310_ADDR, num, true);
^
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/qmc6310.h:4:0,
from /home/david/Téléchargements/zeus-car-main/Zeus_Car/qmc6310.cpp:1:
/home/david/.local/share/arduino-1.8.19/hardware/arduino/avr/libraries/Wire/src/Wire.h:69:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int)
uint8_t requestFrom(int, int, int);
^~~~~~~~~~~
/home/david/.local/share/arduino-1.8.19/hardware/arduino/avr/libraries/Wire/src/Wire.h:66:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t, uint8_t);
^~~~~~~~~~~
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:1:0:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:111:5: warning: ‘template class ArduinoJson::V730JB11::StaticJsonDocument’ is deprecated [-Wdeprecated-declarations]
StaticJsonDocument<200> send_doc;
^~~~~~~~~~~~~~~~~~
In file included from /home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson.hpp:56:0,
from /home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson.h:9,
from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:6,
from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:1:
/home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
class ARDUINOJSON_DEPRECATED(“use JsonDocument instead”) StaticJsonDocument
^~~~~~~~~~~~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp: In member function ‘void AiCamera::setOnReceived(void ()(char, char*))’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:83:77: warning: invalid conversion from ‘void ()(char, char*)’ to ‘void ()()’ [-fpermissive]
void AiCamera::setOnReceived(void (func)(char, char)) { on_receive = func; }
^~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp: At global scope:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:575:81: warning: default argument given for parameter 4 of ‘void AiCamera::setStrOf(char*, uint8_t, String, char)’ [-fpermissive]
void AiCamera::setStrOf(char* str, uint8_t index, String value, char divider=’;‘) {
^
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:1:0:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:148:10: note: previous specification in ‘void AiCamera::setStrOf(char*, uint8_t, String, char)’ here
void setStrOf(char* str, uint8_t index, String value, char divider=’;‘);
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:613:70: warning: default argument given for parameter 3 of ‘int16_t AiCamera::getIntOf(char*, uint8_t, char)’ [-fpermissive]
int16_t AiCamera::getIntOf(char* str, uint8_t index, char divider=’;‘) {
^
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:1:0:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:149:13: note: previous specification in ‘int16_t AiCamera::getIntOf(char*, uint8_t, char)’ here
int16_t getIntOf(char* str, uint8_t index, char divider=’;');
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp: In member function ‘void AiCamera::lamp_on(uint8_t)’:
ai_camera.cpp:636:51: error: no matching function for call to ‘AiCamera::set(const char [5], char*, bool)’
set(“LAMP”, (char )String(level).c_str(), false);
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:291:6: note: candidate: void AiCamera::set(const char)
void AiCamera::set(const char* command) {
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:291:6: note: candidate expects 1 argument, 3 provided
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:312:6: note: candidate: void AiCamera::set(const char*, const char*)
void AiCamera::set(const char* command, const char* value) {
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:312:6: note: candidate expects 2 arguments, 3 provided
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp: In member function ‘void AiCamera::lamp_off()’:
ai_camera.cpp:641:25: error: no matching function for call to ‘AiCamera::set(const char [5], const char [2], bool)’
set(“LAMP”, “0”, false);
^
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:291:6: note: candidate: void AiCamera::set(const char*)
void AiCamera::set(const char* command) {
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:291:6: note: candidate expects 1 argument, 3 provided
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:312:6: note: candidate: void AiCamera::set(const char*, const char*)
void AiCamera::set(const char* command, const char* value) {
^~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.cpp:312:6: note: candidate expects 2 arguments, 3 provided
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:40:0:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:111:5: warning: ‘template class ArduinoJson::V730JB11::StaticJsonDocument’ is deprecated [-Wdeprecated-declarations]
StaticJsonDocument<200> send_doc;
^~~~~~~~~~~~~~~~~~
In file included from /home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson.hpp:56:0,
from /home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson.h:9,
from /home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:6,
from /home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:40:
/home/david/Arduino/libraries/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
class ARDUINOJSON_DEPRECATED(“use JsonDocument instead”) StaticJsonDocument
^~~~~~~~~~~~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino: In function ‘void setup()’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:158:34: warning: invalid conversion from ‘void ()()’ to 'void ()(char*, char*)’ [-fpermissive]
aiCam.setOnReceived(onReceive);
^
In file included from /home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:40:0:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/ai_camera.h:115:10: note: initializing argument 1 of ‘void AiCamera::setOnReceived(void ()(char, char*))’
void setOnReceived(void (func)(char, char*));
^~~~~~~~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino: In function ‘void modeHandler()’:
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:295:5: warning: jump to case label [-fpermissive]
default:
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:282:12: note: crosses initialization of ‘bool changed’
bool changed = compassCalibrateLoop();
^~~~~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino: In function ‘void onReceive()’:
Zeus_Car:614:23: error: ‘lamp’ was not declared in this scope
Serial.println(“lamp on”);
^~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:614:23: note: suggested alternative: ‘map’
Serial.println(“lamp on”);
^~~~
map
Zeus_Car:617:23: error: ‘lamp’ was not declared in this scope
Serial.println(“lamp off”);
^~~~
/home/david/Téléchargements/zeus-car-main/Zeus_Car/Zeus_Car.ino:617:23: note: suggested alternative: ‘map’
Serial.println(“lamp off”);
^~~~
map
exit status 1
stray ‘\342’ in program
What am I doing wrong?
At least, can you made changes into the original codes, test it on a Zeus car, confirm that’s work and send me the files?
I have added CAM lamp control to the code. You can re-download the modified code from github GitHub - sunfounder/zeus-car: SunFounder FPV Omni Car for Arduino
It works, thanks you SOOOOOO MUCH. I think alot of persons will like this feature.