Relay control connected to the Arduino Mega

Hi everyone.
I am trying to make a relay control connected to the Arduino Mega. I make buttons through the widget according to the example from the Cayenne MQTT library. Only the button doesn’t work.
To connect to the Internet, I use the AiThinker A6 GPRS GSM modem. I ask for help.

which code are you using?

#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
#define TINY_GSM_MODEM_A6
#include <CayenneMQTTGSM.h>
#define gsmSerial Serial3
char apn = “internet”;
char gprsLogin = “gdata”;
char gprsPassword = “gdata”;
char pin = “”;
char username = “xxxxxxxxxxxxxxxxxxxxx”;
char password = “xxxxxxxxxxxxxxxxxxxxx”;
char clientID = “xxxxxxxxxxxxxxxxxxxxxx”;
float t, h, p;
double ValueL;
#define Liht 2

void setup()
{
Serial.begin(9600);
pinMode(Power, OUTPUT);
digitalWrite(Power, LOW);
delay (2000);
digitalWrite(Power, HIGH);
delay (3000);
digitalWrite(Power, LOW);
delay (1000);
pinMode(Liht, OUTPUT);
digitalWrite(Liht, HIGH);
Wire.begin();
bme.begin(0X76);
TinyGsmAutoBaud(gsmSerial);
Cayenne.begin(username, password, clientID, gsmSerial, apn, gprsLogin, gprsPassword, pin);
}

void loop()
{
Cayenne.loop();
}

CAYENNE_OUT(0)
{
t = bme.readTemperature();
Cayenne.virtualWrite(0, t);
}

CAYENNE_OUT(1)
{
h = bme.readHumidity();
Cayenne.virtualWrite(1, h);
}

CAYENNE_OUT(2)
{
p = bme.readPressure() * 0.00750062;
Cayenne.virtualWrite(2, p);
}

CAYENNE_IN(3)
{
ValueL = getValue.asInt();
if (ValueL == 0)
{
ValueL = HIGH;
}
else
{
ValueL = LOW;
}
CAYENNE_LOG(“Channel %d, pin %d, value %d”, 3, Liht, ValueL);
digitalWrite(Liht, ValueL);
}

CAYENNE_OUT(9)
{
Cayenne.virtualWrite (9, millis() / 1000 );
}

can you share the serial monitor output?

also simplifying the code:-

CAYENNE_IN(3)
{
ValueL = getValue.asInt();
digitalWrite(Liht, !ValueL);
}

And another question.
The Cayenne polls the sensor every 24 seconds. How to reduce this time?

what do you get in the serial monitor when you press the button the cayenne dashboard?

Nothing.

Does your device get disconnect ?

No.

can you private message me your email id, so i can have a look at your dashboard.

How i can get email id?

i mean the email id (username) used to login into cayenne.

Can you create a new device with the following steps:- Add new ---> Device/Widget ---> Microcontroller --> Arduino Copy the client id and replace it in your code. Upload and add the new actuator generic button.

you mean generic digital output?

Ready.

can you join me on slack http://slack.mydevices.com/

Yes. I’m already there