Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.
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 in Programmer Questions by JeVoisNewbie (410 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

port='/dav/ttyACM0'

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 by PeterQuinn (820 points)
selected Jul 9 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.
...