Receiving data through uart in raspberry pi 3b

99封情书 提交于 2020-02-06 07:29:29

问题


I want to do real time voice transmission through uart of two raspberry pi 3b.Currently I am able to transmit the real time voice through uart by recording the audio in fifo file and at the same time writing that file to uart(Tx). But at receiving side I am not able to receive data properly.The code i am using is as below.

import os
import serial
import select
ser=serial.Serial('/dev/ttyS0',19200)
os.system('mkfifo audio1.fifo')
with open('audio1.fifo') as fifo:
    while True:
        select.select([fifo],[],[fifo])
        x=ser.readline() 
        x=fifo.write()

Above code is only creating fifo file but not writing in it.As well ,I also want to do that when it start writing in it it should play audio on 3.5mmm jack. Plz give me some suggestions/corrections.

来源:https://stackoverflow.com/questions/59676120/receiving-data-through-uart-in-raspberry-pi-3b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!