Skip to content

Sensor Data #65

Open
Open
@emersonsc

Description

@emersonsc

Im trying to display the Temp and humidity data using the sensors built in to the Clue, but i tried using the code bellow, but i get an error:
Traceback (most recent call last):
File "code.py", line 7, in
File "adafruit_clue.py", line 930, in
File "adafruit_clue.py", line 195, in init
ValueError: P5 in use

# Write your code here :-)
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import board
from adafruit_pybadger import pybadger
from adafruit_clue import clue
from adafruit_bmp280 import bmp280

temperature = clue.temperature
humidity = clue.humidity

pybadger.badge_background(
    background_color=pybadger.YELLOW,
    rectangle_color=pybadger.BLUE,
    rectangle_drop=0.2,
    rectangle_height=0.6,
)

pybadger.badge_line(
    text="Stingers of Steel", color=pybadger.BLUE, scale=2, padding_above=2
)
pybadger.badge_line(text="Emerson C.", color=pybadger.YELLOW, scale=4, padding_above=4)
pybadger.badge_line(
    text="Mentor / Mechanic", color=pybadger.YELLOW, scale=2, padding_above=2
)
pybadger.badge_line(
    text="Temp: {:.1f} C".format(temperature), color=pybadger.YELLOW, scale=2, padding_above=2
)
pybadger.badge_line(
    text="Humi: {:.1f} %".format(humidity), color=pybadger.YELLOW, scale=2, padding_above=2
)
pybadger.badge_line(
    text="6642", color=pybadger.BLUE, scale=4, padding_above=10
)

display = board.DISPLAY
display.rotation = 180

pybadger.show_custom_badge()

while True:
    
    if pybadger.button.a:
        pybadger.show_qr_code("https://www.facebook.com/stingers6642")
        pybadger.pixels.fill(pybadger.BLUE)
    if pybadger.button.b:
        pybadger.show_custom_badge()
        pybadger.pixels.fill(pybadger.YELLOW)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions