Compiling errors on Arduino Wifi Rev2

Hi,

I’m trying to get the void exe_color_detection to work over UART communication between an Arduino Wifi Rev2 and an OpenMV Cam H7 R2. I managed to get the IDE to run and connect with the camera and setting the ‘popular_features_as_the_remote_device.py’ as main.py on the cam.

However on the Arduino side (after installing the OpenMV Arduino RPC library and then nagivating to File > Examples > OpenMV Arduino RPC > popular_features_as_the_controller_device_example I get errors when trying to compile for the board.

Mainly ‘‘rpc_hardware_serial1_uart_master’ in namespace ‘openmv’ does not name a type’ this happens after uncommenting the line: openmv::rpc_hardware_serial1_uart_master interface(115200)

Full crash log is below, any thoughts? Thanks!


Arduino: 1.8.20 Hourly Build 2022/04/25 09:35 (Mac OS X), Board: “Arduino Uno WiFi Rev2, ATMEGA328”

popular_features_as_the_controller_device_example:70:9: error: ‘rpc_hardware_serial1_uart_master’ in namespace ‘openmv’ does not name a type
openmv::rpc_hardware_serial1_uart_master interface(115200);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
popular_features_as_the_controller_device_example:81:9: error: ‘rpc_software_serial_uart_master’ in namespace ‘openmv’ does not name a type
openmv::rpc_software_serial_uart_master interface(2, 3, 19200);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void setup()’:
popular_features_as_the_controller_device_example:91:5: error: ‘interface’ was not declared in this scope
interface.begin();
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_face_detection()’:
popular_features_as_the_controller_device_example:102:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“face_detection”), &face_detection_result, sizeof(face_detection_result))) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_person_detection()’:
popular_features_as_the_controller_device_example:118:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“person_detection”), buff, sizeof(buff) - 1)) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_qrcode_detection()’:
popular_features_as_the_controller_device_example:126:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“qrcode_detection”), buff, sizeof(buff) - 1)) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_apriltag_detection()’:
popular_features_as_the_controller_device_example:134:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“apriltag_detection”), &apriltag_detection_result, sizeof(apriltag_detection_result))) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_datamatrix_detection()’:
popular_features_as_the_controller_device_example:150:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“datamatrix_detection”), buff, sizeof(buff) - 1)) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_barcode_detection()’:
popular_features_as_the_controller_device_example:158:9: error: ‘interface’ was not declared in this scope
if (interface.call_no_args(F(“barcode_detection”), buff, sizeof(buff) - 1)) {
^~~~~~~~~
/var/folders/xp/8d7vzmzj5zb_8dy2z9nl01pw0000gn/T/arduino_modified_sketch_335468/popular_features_as_the_controller_device_example.ino: In function ‘void exe_color_detection()’:
popular_features_as_the_controller_device_example:169:9: error: ‘interface’ was not declared in this scope
if (interface.call(F(“color_detection”), color_thresholds, sizeof(color_thresholds), &color_detection_result, sizeof(color_detection_result))) {
^~~~~~~~~
exit status 1
‘rpc_hardware_serial1_uart_master’ in namespace ‘openmv’ does not name a type

Hi, the error means there’s no Serial1 on your board. You probably just have Serial. So the name to use would then be:

rpc_hardware_serial_uart_master

Hi thanks, this solved it + commenting the line ‘openmv::rpc_software_serial_uart_master interface(2, 3, 19200);’ which was uncommented by default.

However the UNO has only one hardware serial port so I will need to use either the software serial method or SPI or I2C.

I tried the SPI method (see attachment for wiring) - uncommenting SPI line in both the Python script and the Arduino script.

Compiling works on both ends without flaws (in openMV IDE and Arduino IDE) but I don’t get anything in the serial monitor yet in the Arduino. I uncommented the ‘exe_color_detection();’ in the void loop at the bottom of the Arduino script and commented the face tracking one so only 1 callback is active

Once I power up the Arduino I get a short white blink on the OpenMV Cam H7 R2. This would indicate a hardware failure? The Arduino is on fixed psu so it should give enough on the 5V and there is a common ground shared between the cam and the Arduino. Any other thoughts?

Once I connect the camera with micro-usb and open the OpenMV IDE it blinks the green sequence of bootloading, then a short white pulse and then sustained red. I do not see the blue blinking led which is described as running the main.py script healthily. The camera works perfectly though in the preview in the OpenMV IDE.

Any ideas for next steps?

Hi, hooking it up via SPI should work pretty easily. That’s actually a rather robust interface.

1st Make sure you saved the example popular functions script on the OpenMV Cam. Also, make sure you uncommented the SPI interface line. Make note of the SPI settings on that line.

2nd Save that script to the OpenMV Cam.

3rd Reset the OpenMV Cam. It will not be running the blue blinking LED program. Please understand the OpenMV Cam does whatever your script tells it to. The Blue LED program is just a script that runs on default when the camera comes from the factory.

4th Now try to run the script on the Arduino with the SPI part uncommented.

Regarding the color tracking, you have to have good color thresholds. Try the face detection first.