Apologies in advance: This might well be user error. I’m new to python and serial port programming. I’ve bumbled my way through some raspi and arduino projects in the past, but that was probably luck.
I have the Element connected, and online, and I’ve activated the Atom as well. Using a Raspi 3 model B. I disabled the console for the serial port as recommended. Trying to run your basic.py example, and getting an error.
Traceback (most recent call last): File "basic.py", line 4, in <module> helium.connect() File "helium_client/_helium.pyx", line 190, in helium_client._helium.Helium.connect (helium_client/_helium.c:2671) File "helium_client/_helium.pyx", line 120, in helium_client._helium._check_result (helium_client/_helium.c:1903) helium_client._helium.CommunicationError: 2
Here’s the script. I didn’t modify any code beyond changing the serial port.
from helium_client import Helium helium = Helium("/dev/ttyAMA0") helium.connect() channel = helium.create_channel("Tempathic MQTT") channel.send("Serial test")
Checking the serial ports:
dmesg | grep tty
[ 0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles [ 0.001246] console [tty1] enabled [ 1.082324] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2 [ 1.091939] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 220, base_baud = 31250000) is a 16550
I don’t know which port I’m supposed to use. Leaving it at serial0 does nothing.