Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CapableRobot_USBHub_CircuitPython_Examples/host_examples/spi.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
30 lines (22 sloc)
687 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import logging | |
import sys | |
import bridge | |
import capablerobot_usbhub | |
import capablerobot_bmi160 | |
def setup_logging(): | |
fmtstr = '%(asctime)s | %(filename)25s:%(lineno)4d %(funcName)20s() | %(levelname)7s | %(message)s' | |
formatter = logging.Formatter(fmtstr) | |
handler = logging.StreamHandler(sys.stdout) | |
handler.setLevel(logging.DEBUG) | |
handler.setFormatter(formatter) | |
logger = logging.getLogger() | |
logger.setLevel(logging.DEBUG) | |
logger.addHandler(handler) | |
# setup_logging() | |
hub = capablerobot_usbhub.USBHub() | |
bmi = capablerobot_bmi160.BMI160(hub.spi, use_spi=True) | |
print(bmi.id) | |
while True: | |
print(bmi.time, bmi.temperature) | |
time.sleep(1) |