Python SDK to control Lightbox Pro over USB serial
Project description
Lightbox SDK
Version 1.0.1 — Python SDK for controlling the Lightbox Pro over USB serial.
Install
pip install lightbox-sdk
Or install from source in editable mode:
cd python
pip install -e .
Quick start
from lightbox_sdk import Lightbox
with Lightbox() as lb: # auto-detect port
lb.ping() # verify connection
lb.set_pixel(0, 255, 0, 0) # LED 0 → red
lb.set_leds([(0, 0, 0, 80)] * 96) # all LEDs → dim white
lb.off() # all off
Explicit port:
with Lightbox("COM4") as lb:
print(lb.version()) # "1.0.0"
print(lb.status()) # "idle"
Well positions
LEDs are in a 96-well plate grid (rows A–H, columns 1–12) matching the ANSI microplate standard layout. Use well() to address by name:
from lightbox_sdk import Lightbox, well, well_row, well_column
with Lightbox() as lb:
lb.set_pixel(well("A1"), 255, 0, 0) # well A1 → red
lb.set_pixel(well("D6"), 0, 0, 200) # well D6 → blue
for idx in well_row("A"): # all 12 wells in row A
lb.set_pixel(idx, 0, 80, 0)
for idx in well_column(6): # all 8 wells in column 6
lb.set_pixel(idx, 80, 0, 80)
For numeric loops (e.g. animations), xy(col, row) is also available:
from lightbox_sdk import xy
idx = xy(5, 3) # column 5 (="6"), row 3 (="D") → same as well("D6")
Run an experiment
with Lightbox() as lb:
lb.run_experiment_json("experiment.json")
while lb.status() == "running":
time.sleep(0.5)
print("Done!")
Error handling
from lightbox_sdk import Lightbox, LightboxError, LightboxTimeout, LightboxConnectionError
try:
with Lightbox("COM4") as lb:
lb.ping()
except LightboxConnectionError:
print("Cannot connect")
except LightboxTimeout:
print("Device not responding")
except LightboxError as e:
print(f"Device error: {e}")
Package layout
lightbox_sdk/
├── __init__.py # Public exports, version
├── client.py # Lightbox class, connection, commands
└── constants.py # LED_COUNT, well(), xy(), helpers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lightbox_sdk-1.0.1.tar.gz.
File metadata
- Download URL: lightbox_sdk-1.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d716cf11f40143b73ad6c71784614b6a32d0cac7e0d99015a7e5d0ca23889e4
|
|
| MD5 |
18b3c40aad683e0d8ddc875d62874e9f
|
|
| BLAKE2b-256 |
7fadd63fe7ea09ccba45b7d03aa002480de8b2349af9206dd70d47328d05ed2b
|
File details
Details for the file lightbox_sdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: lightbox_sdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a6234fc4af609c889309178d6318ba6fb1adf40c5f124d3ca21f5d7923ccbe2
|
|
| MD5 |
3a3a865bd9a82e8986d8c547e608349a
|
|
| BLAKE2b-256 |
0285460d230b8097a84e9d4d673d83dff4eeb322a73ef23ae277ebaf376943bc
|