Skip to main content

Expansion board

Stemi Shield has a companion expansion board with two sensors and two pumps.

Expansion board

Library

Stemi expansion board library exposes two classes representing the board and two sensors included on it.

expansion_board.py
class Sensor:
def __init__(board):
...

@property
def ldr(self):
...

@property
def temp(self):
...

@property
def humidity(self):
...

class ExpansionBoard:
sensor1 = Sensor()
sensor2 = Sensor()

def __init__(i2c):
...

def read():
...

Explanations

ReturnsDescription
__init__an ExpansionBoard instancecreates an instance of ExpansionBoard and sets up two Sensors
readNonereads current sensor data and saves the values for use
ldr0-1024 intreturns current value, will call read if enough time has passed since last reading
temptemp (°C)returns current value, will call read if enough time has passed since last reading
humidity0-1024 intreturns current value, will call read if enough time has passed since last reading

Example

main.py
from stemi.expansion_board import ExpansionBoard

eb = ExpansionBoard(i2c)

print(eb.sensor1.temp)
print(eb.sensor1.humidity)
note

i2c is a global variable that you'll be provided with