You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on a sketch for a staircase light. It's meant to be a running light triggered by either a switch, a second arduino board or matter. In my case I'm using HomeKit to test. Everything is working fine but I can't get the shown states in the App similar to what's in front of me on my board or the serial monitor. It's either doing sth. like being shown as "ON" an you have to press twice to activate the code or it's shown off and you have to press once. In both cases it's setting itself back to its former state after 10 seconds which means if It's and and I press it once it turns off for 10 seconds and back on again without triggering the arduino. If It's off and you press it it triggers the arduino and turns itself off after 10 seconds in the app. I just can't find a function or explanation for this maybe someone can help.
int loopHelp_1 = 0;
int loopHelp_2 = 0;
int loopSlave = 0;
const long delayTime = 500;
const long delayTimeMaster = 100;
unsigned long millisCount = 0;
unsigned long millisCountStored = 0;
int lightNumber = 0;
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Matter.begin();
lauflicht.begin();
lauflicht.set_onoff(0);
pinMode(trigger, INPUT);
pinMode(slave, INPUT);
for (int i = 2; i < 13; i++)
{
pinMode(i, OUTPUT);
}
if (!Matter.isDeviceCommissioned()) {
Serial.println("Matter device is not commissioned");
Serial.println("Commission it to your Matter hub with the manual pairing code or QR code");
Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str());
Serial.printf("QR code URL: %s\n", Matter.getOnboardingQRCodeUrl().c_str());
}
while (!Matter.isDeviceCommissioned()) {
delay(200);
}
Serial.println("Waiting for Thread network...");
while (!Matter.isDeviceThreadConnected()) {
delay(200);
}
Serial.println("Connected to Thread network");
Serial.println("Waiting for Matter device discovery...");
while (!lauflicht.is_online()) {
delay(200);
}
Serial.println("Matter device is now online");
}
void loop()
{
// put your main code here, to run repeatedly:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm currently working on a sketch for a staircase light. It's meant to be a running light triggered by either a switch, a second arduino board or matter. In my case I'm using HomeKit to test. Everything is working fine but I can't get the shown states in the App similar to what's in front of me on my board or the serial monitor. It's either doing sth. like being shown as "ON" an you have to press twice to activate the code or it's shown off and you have to press once. In both cases it's setting itself back to its former state after 10 seconds which means if It's and and I press it once it turns off for 10 seconds and back on again without triggering the arduino. If It's off and you press it it triggers the arduino and turns itself off after 10 seconds in the app. I just can't find a function or explanation for this maybe someone can help.
Many thanks.
`
#include <Matter.h>
#include <MatterLightbulb.h>
MatterLightbulb lauflicht;
const int trigger = A0;
const int slave = A1;
int loopHelp_1 = 0;
int loopHelp_2 = 0;
int loopSlave = 0;
const long delayTime = 500;
const long delayTimeMaster = 100;
unsigned long millisCount = 0;
unsigned long millisCountStored = 0;
int lightNumber = 0;
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Matter.begin();
lauflicht.begin();
lauflicht.set_onoff(0);
pinMode(trigger, INPUT);
pinMode(slave, INPUT);
for (int i = 2; i < 13; i++)
{
pinMode(i, OUTPUT);
}
if (!Matter.isDeviceCommissioned()) {
Serial.println("Matter device is not commissioned");
Serial.println("Commission it to your Matter hub with the manual pairing code or QR code");
Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str());
Serial.printf("QR code URL: %s\n", Matter.getOnboardingQRCodeUrl().c_str());
}
while (!Matter.isDeviceCommissioned()) {
delay(200);
}
Serial.println("Waiting for Thread network...");
while (!Matter.isDeviceThreadConnected()) {
delay(200);
}
Serial.println("Connected to Thread network");
Serial.println("Waiting for Matter device discovery...");
while (!lauflicht.is_online()) {
delay(200);
}
Serial.println("Matter device is now online");
}
void loop()
{
// put your main code here, to run repeatedly:
static bool matter_lightbulb_last_state = false;
bool matter_lightbulb_current_state = lauflicht.get_onoff();
loopHelp_2 = digitalRead(trigger);
loopSlave = digitalRead(slave);
if (loopHelp_1 == 0 && (loopHelp_2 == 1 || loopSlave == 1 || matter_lightbulb_current_state))
{
lightNumber = 2;
millisCountStored = millis();
loopHelp_1 = 1;
}
if (lightNumber >= 2 && lightNumber <= 11)
{
digitalWrite(lightNumber, HIGH);
millisCount = millis();
}
else if(lightNumber > 11 && lightNumber < 13)
{
digitalWrite(lightNumber, HIGH);
millisCount = millis();
}
else if (lightNumber >= 13)
{
lightNumber = 0;
loopHelp_1 = 0;
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions