我无法通过USB从arduino到树莓派获取数据

时间:2019-05-02 15:13:51

标签: python arduino raspberry-pi usb

我在从USB端口上的Arduino树莓中获取数据时遇到问题。在端口监视器中连接到Windows时,我看到了来自GPS和加速度计的数据。但是,当连接到树莓时,数据不会出现。可能是什么问题?

import serial
import time
ser = serial.Serial("/dev/ttyUSB0", 115200)


while 1:
    new_ser = ser.readline()
    print new_ser

dmesg | grep tty

pi@raspberrypi:~ $ dmesg | grep tty
[    0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 root=PARTUUID=b10cf8df-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000282] console [tty1] enabled
[    0.665506] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    0.667000] console [ttyS0] disabled
[    0.667028] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 166, base_baud = 31250000) is a 16550
[    0.667075] console [ttyS0] enabled
[    3.509261] usb 1-1.4: ch341-uart converter now attached to ttyUSB0

0 个答案:

没有答案