Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Problems using broadcastnet on a Feather Sense, no move_to_e
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problems using broadcastnet on a Feather Sense, no move_to_e

by thingstimes on Sat Jan 23, 2021 1:12 am

I am trying to run the example code for a BLE sensor node on a Feather nRF52840 Sense and ran into difficulties. First of all, apparently something has changed in the adafruit_lsm6ds module because that gives an error. That isn't a big problem for me because I am not interested in accelerometer data anyway. But maybe it is reflective of some general problem in my setup. I just commented out the two relevant lines.
Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "code.py", line 13, in <module>
AttributeError: 'module' object has no attribute 'lsm6ds33'


More troublesome is that I get an error when doing the broadcast on line 30 of
Code: Select all | TOGGLE FULL SIZE
"""This uses the Feather Sense as a Bluetooth LE sensor node."""

import time
import adafruit_ble_broadcastnet
import board
import adafruit_lsm6ds   # accelerometer
import adafruit_sht31d   # humidity sensor
import adafruit_bmp280   # barometric sensor
import adafruit_lis3mdl  # magnetic sensor

i2c = board.I2C()

#sense_accel = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
sense_humid = adafruit_sht31d.SHT31D(i2c)
sense_barometric = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
sense_magnet = adafruit_lis3mdl.LIS3MDL(i2c)

print("This is BroadcastNet Feather Sense sensor:", adafruit_ble_broadcastnet.device_address)

while True:
    measurement = adafruit_ble_broadcastnet.AdafruitSensorMeasurement()

    measurement.temperature = sense_barometric.temperature
    measurement.pressure = sense_barometric.pressure
    measurement.relative_humidity = sense_humid.relative_humidity
    #measurement.acceleration = sense_accel.acceleration
    measurement.magnetic = sense_magnet.magnetic

    # print(measurement)
    adafruit_ble_broadcastnet.broadcast(measurement)  # <<< ERROR HERE
    time.sleep(60)

where it is using a method that is not implemented in OrderedDict:
Code: Select all | TOGGLE FULL SIZE
code.py output:
This is BroadcastNet Feather Sense sensor: e1ea5705e4b6
Traceback (most recent call last):
  File "code.py", line 30, in <module>
  File "adafruit_ble_broadcastnet.py", line 54, in broadcast
  File "adafruit_ble/__init__.py", line 183, in start_advertising
  File "adafruit_ble_broadcastnet.py", line 188, in __bytes__
AttributeError: 'OrderedDict' object has no attribute 'move_to_end'

Code done running.

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Feather Bluefruit Sense with nRF52840
>>> from collections import OrderedDict
>>> x = OrderedDict([(0,1), (2,3)])
>>> x.move_to_end(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'OrderedDict' object has no attribute 'move_to_end'


You can see above that I'm using CircuitPython 6.1.0 but had run into this problem last week with a previous version. I made sure my version of adafruit_ble_broadcastnet is the most recent, from adafruit-circuitpython-bundle-6.x-mpy-20210122.

Is this a problem of this version of CircuitPython not implementing OrderedDict.move_to_end like expected, the broadcastnet library, or maybe I'm doing something wrong?

thingstimes
 
Posts: 2
Joined: Wed Dec 16, 2020 9:56 pm

Re: Problems using broadcastnet on a Feather Sense, no move_

by tannewt on Sun Jan 24, 2021 11:04 pm

This is a bug because the library was only tested in CPython (not CircuitPython.) Please try an earlier version and file an issue here: https://github.com/adafruit/Adafruit_Ci ... Net/issues

Thanks!

tannewt
 
Posts: 2393
Joined: Thu Oct 06, 2016 8:48 pm

Re: Problems using broadcastnet on a Feather Sense, no move_

by thingstimes on Mon Jan 25, 2021 7:49 pm


thingstimes
 
Posts: 2
Joined: Wed Dec 16, 2020 9:56 pm

Re: Problems using broadcastnet on a Feather Sense, no move_

by rpruiz on Wed Mar 17, 2021 1:22 pm

FYI, seems the last working release that works is the one from 20210106.

rpruiz
 
Posts: 1
Joined: Thu Apr 18, 2013 6:50 pm

Please be positive and constructive with your questions and comments.