Skip to content

Anyway to detect if DLight-HAT is plugged in? Very slow to just check. #7

Description

@konacurrents

I've been using the DLight-HAT with my M5 very nicely. I also have a motion PIR sensor. I'm using these
to turn on my Christmas lights with the M5Socket (via MQTT messages).

My issue is when the DLight-HAT is NOT plugged in, the call to get the LUX is very slow, and breaks
my event loops (especially the button press of the M5).

#include <M5_DLight.h>
//! the sensor object for the DLight
   M5_DLight _M5DLightSensor;

    uint16_t lux = _M5DLightSensor.getLUX();

With this HAT (or UNIT) and others, is there way to query whether it's plugged in?
The Wire.h has an available call but it didn't provide anything valuable.

With the plug-n-play aspect of these HATs, I was hoping not to have code that is
configured (at runtime) whether the HAT is plugged in.

NOTE: when the PIR motion sensor isn't plugged in, it is still fast.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions