0

Readout Circuitpython data with a python script
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Readout Circuitpython data with a python script

by TobyGraf on Fri Apr 09, 2021 6:18 am

Hi all,

Is it possible to setup a python script to extract data from a circuitpython Board? I am using the Feather STM32F405 Express in combination with the BME280(with circuitpython). My goal is to read the data(temp, hum, pres) and safe them in a file for example word. So is it possible to set up such a skript and if yes any tips on how?

thanks for your help
Toby

This is the circuitpython code i am running on the Feather:
Code: Select all | TOGGLE FULL SIZE
import time
import board
import busio
import adafruit_bme280
import digitalio

# create library object using the Bus SPI port
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
bme_cs = digitalio.DigitalInOut(board.D5)
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)

# change this to match the location's pressure (hPa) at sea level
bme280.sea_level_pressure = 1024.25

while True:
    print("\nTemperature: %0.1f C" % bme280.temperature)
    print("Humidity: %0.1f %%" % bme280.relative_humidity)
    print("Pressure: %0.1f hPa" % bme280.pressure)
    print("Altitude = %0.2f meters" % bme280.altitude)
    time.sleep(10)

TobyGraf
 
Posts: 1
Joined: Fri Apr 09, 2021 6:10 am

Re: Readout Circuitpython data with a python script

by tannewt on Fri Apr 09, 2021 11:27 am

Generally folks use pyserial on the host to read the serial connection to CircuitPython.

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

Please be positive and constructive with your questions and comments.