Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

How to send serial message to text file

0 votes
Hello, I'd like to receive serial messages (ID, location, size) from the camera and write it down to a text file located in the micro-SD card. Would it be possible to show both Python and C++ method to achieve this?
asked Jul 5, 2018 in Programmer Questions by JeVoisNewbie (430 points)

1 Answer

0 votes
Best answer
If you're writing python on a computer where you've connected the device via serial or USB, it's pretty easy.  There's a serial library that does the hard work of reading serial.

Something like

import serial


ser = serial.Serial(port,115200,timeout=1)

line = ser.readline()

print (line.decode('utf8'))

#open your text file and write the line, might want to decode the binary

If you send the USBSD command, you can access the SD card just like any device/file and put your file there.

If you want to put this on the device itself, perhaps someone else can give you some hints. I haven't tried that.
answered Jul 8, 2018 by PeterQuinn (1,020 points)
selected Jul 9, 2018 by JeVoisNewbie
Thank you for your reply. As you pointed out, I am trying to write the file directly onto the micro-SD which is found inside the JeVois Camera, since this would take care of the USBSD command and copy/pasting of the file. I hope someone can give me hints about this, but for the time being, I will try to experiment and play around with it for a while.