Pergunta

I am using a Beaglebone Black (BBB) with Python and pyserial to communicate with an OBD-II reader. I am essentially trying to build a customizable digital gauge panel. Ideally I would like to use Flash for the GUI. Sadly Linux support for Flash is pretty weak. I would like to be able to send data from the BBB using Python to a OSX host computer.

I am currently using terminal to shell into the BBB to run code. I would need to be able to send data from the BBB via a USB/serial interface to the OSX computer running Flash. What would be the best method of accomplishing this?

Foi útil?

Solução

I have not used beaglebone. I have worked with arduino's serial I/O. But this post says you have multiple serial I/O ports on BBB. Find appropriate connectors/convertors for serial to USB.

Then use the pyserial python module. On OSX, you will find your device when connected on a path like /dev/ttyo1 where dev is my system name and ttyo1 or something similar will be your device.

import serial as s
device = "/dev/tty01"
bbb = s.Serial(device, 4800) #the second param is baudrate

while(True):
    bbb.readline()
    # do what you want with the output.
    bbb.write('input')

This will read till the end of line character and give you a string. and then write "input" to the serial io on bbb. You will need a similar program running on BBB to read this input and do what you want to do with it.

So there will be two python programs. One on the OSX and the other on the BBB

That way you can give commands from OSX.py, let your BBB.py process and send a response. Which the OSX.py will read and do what is to be done.

You will have to design the input/output cycle properly.

Also if flash is not really necessary you can check out pyside.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top