send values to serial port

General discussion about topics related to OpenMV.
luisantunespena
Posts: 4
Joined: Wed Jun 06, 2018 11:11 am

send values to serial port

Postby luisantunespena » Wed Jun 06, 2018 11:24 am

Hello,
I'm using the example multi_color_blob_tracking_1.py and would like to send the main values frame size for red, green and blue to a serial port. The idea is to communicate with another program called csound (an audio processing software) which can receive serial data.
Which functions do I need for this?
Thank you.
Luis
User avatar
kwagyeman
Posts: 2121
Joined: Sun May 24, 2015 2:10 pm

Re: send values to serial port

Postby kwagyeman » Wed Jun 06, 2018 12:48 pm

Hi, for serial port sending please see the pixy emulation examples. They show off how to send data via the serial port.
Nyamekye,
luisantunespena
Posts: 4
Joined: Wed Jun 06, 2018 11:11 am

Re: send values to serial port

Postby luisantunespena » Thu Jun 07, 2018 11:00 am

Thanks for your answer. I was wondering if once the OpenMV Cam is connected via USB to the computer, if there is a simpler way to grab data from the camera. If so, could you give me an example? Thank you in advance.
User avatar
kwagyeman
Posts: 2121
Joined: Sun May 24, 2015 2:10 pm

Re: send values to serial port

Postby kwagyeman » Thu Jun 07, 2018 11:44 am

Hi, literally just use the print() method on objects. The output will then appear in the terminal in OpenMV IDE. A y program on a the computer can open the OpenMV Cam's serial port and read the print output while the script is running.
Nyamekye,
luisantunespena
Posts: 4
Joined: Wed Jun 06, 2018 11:11 am

Re: send values to serial port

Postby luisantunespena » Thu Jun 07, 2018 1:49 pm

Thanks for your kind reply! I'll try that.
Luis
User avatar
kwagyeman
Posts: 2121
Joined: Sun May 24, 2015 2:10 pm

Re: send values to serial port

Postby kwagyeman » Thu Jun 07, 2018 3:31 pm

Note you cannot use OpenMV IDE with the camera if another program is reading the serial port at the same time. To make your script permanent on the OpenMV Cam use Tools -> Save script to the OpenMV Cam.
Nyamekye,
luisantunespena
Posts: 4
Joined: Wed Jun 06, 2018 11:11 am

Re: send values to serial port

Postby luisantunespena » Fri Jun 08, 2018 3:23 am

That's it! Thank you very, very much! Now csound is receiving data from OpenMV!
And thanks for creating this wonderful project!
Luis

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 3 guests