after the update I’m getting crazy, the inputs do not work and only some outputs.
the arduino is connected but something is wrong, and correct the program?
#include <CayenneMQTTSerial.h>
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";
//************* Action pins Out 1°piano rele N.O.************************
#define VIRTUAL_CHANNEL22 22
#define VIRTUAL_CHANNEL24 24
#define VIRTUAL_CHANNEL26 26
#define VIRTUAL_CHANNEL28 28
#define VIRTUAL_CHANNEL30 30
#define VIRTUAL_CHANNEL32 32
#define VIRTUAL_CHANNEL34 34
#define VIRTUAL_CHANNEL36 36
#define VIRTUAL_CHANNEL38 38
#define VIRTUAL_CHANNEL40 40
#define VIRTUAL_CHANNEL42 42
#define VIRTUAL_CHANNEL44 44
#define VIRTUAL_CHANNEL46 46
#define VIRTUAL_CHANNEL48 48
#define VIRTUAL_CHANNEL50 50
#define VIRTUAL_CHANNEL52 52
#define ACTUATOR_PIN22 22
#define ACTUATOR_PIN24 24
#define ACTUATOR_PIN26 26
#define ACTUATOR_PIN28 28
#define ACTUATOR_PIN30 30
#define ACTUATOR_PIN32 32
#define ACTUATOR_PIN34 34
#define ACTUATOR_PIN36 36
#define ACTUATOR_PIN38 38
#define ACTUATOR_PIN40 40
#define ACTUATOR_PIN42 42
#define ACTUATOR_PIN44 44
#define ACTUATOR_PIN46 46
#define ACTUATOR_PIN48 48
#define ACTUATOR_PIN50 50
#define ACTUATOR_PIN52 52
//*************Action pins Input gnd 2°piano************************************
#define VIRTUAL_CHANNEL2 2
#define VIRTUAL_CHANNEL3 3
#define VIRTUAL_CHANNEL4 4
#define VIRTUAL_CHANNEL5 5
#define VIRTUAL_CHANNEL6 6
#define VIRTUAL_CHANNEL7 7
#define VIRTUAL_CHANNEL8 8
#define VIRTUAL_CHANNEL9 9
#define VIRTUAL_CHANNEL10 10
#define VIRTUAL_CHANNEL11 11
#define VIRTUAL_CHANNEL12 12
#define VIRTUAL_CHANNEL13 13
#define VIRTUAL_CHANNEL14 14
#define VIRTUAL_CHANNEL15 15
#define VIRTUAL_CHANNEL16 16
#define VIRTUAL_CHANNEL17 17
#define SENSOR_PIN2 2
#define SENSOR_PIN3 3
#define SENSOR_PIN4 4
#define SENSOR_PIN5 5
#define SENSOR_PIN6 6
#define SENSOR_PIN7 7
#define SENSOR_PIN8 8
#define SENSOR_PIN9 9
#define SENSOR_PIN10 10
#define SENSOR_PIN11 11
#define SENSOR_PIN12 12
#define SENSOR_PIN13 13
#define SENSOR_PIN14 14
#define SENSOR_PIN15 15
#define SENSOR_PIN16 16
#define SENSOR_PIN17 17
//*************Action pins Input + 2°piano************************************
#define VIRTUAL_CHANNEL23 23
#define VIRTUAL_CHANNEL25 25
#define VIRTUAL_CHANNEL27 27
#define VIRTUAL_CHANNEL29 29
#define VIRTUAL_CHANNEL31 31
#define VIRTUAL_CHANNEL33 33
#define VIRTUAL_CHANNEL35 35
#define VIRTUAL_CHANNEL37 37
#define VIRTUAL_CHANNEL39 39
#define VIRTUAL_CHANNEL41 41
#define VIRTUAL_CHANNEL43 43
#define VIRTUAL_CHANNEL45 45
#define VIRTUAL_CHANNEL47 47
#define VIRTUAL_CHANNEL49 49
#define VIRTUAL_CHANNEL51 51
#define VIRTUAL_CHANNEL53 53
#define SENSOR_PIN23 23
#define SENSOR_PIN25 25
#define SENSOR_PIN27 27
#define SENSOR_PIN29 29
#define SENSOR_PIN31 31
#define SENSOR_PIN33 33
#define SENSOR_PIN35 35
#define SENSOR_PIN37 37
#define SENSOR_PIN39 39
#define SENSOR_PIN41 41
#define SENSOR_PIN43 43
#define SENSOR_PIN45 45
#define SENSOR_PIN47 47
#define SENSOR_PIN49 49
#define SENSOR_PIN51 51
#define SENSOR_PIN53 53
void setup()
{
//Serial.begin(9600);
//Baud rate can be specified by calling Cayenne.begin(username, password, clientID, 9600);
Cayenne.begin(username, password, clientID);
pinMode (ACTUATOR_PIN22, OUTPUT);
pinMode (ACTUATOR_PIN24, OUTPUT);
pinMode (ACTUATOR_PIN26, OUTPUT);
pinMode (ACTUATOR_PIN28, OUTPUT);
pinMode (ACTUATOR_PIN30, OUTPUT);
pinMode (ACTUATOR_PIN32, OUTPUT);
pinMode (ACTUATOR_PIN34, OUTPUT);
pinMode (ACTUATOR_PIN36, OUTPUT);
pinMode (ACTUATOR_PIN38, OUTPUT);
pinMode (ACTUATOR_PIN40, OUTPUT);
pinMode (ACTUATOR_PIN42, OUTPUT);
pinMode (ACTUATOR_PIN44, OUTPUT);
pinMode (ACTUATOR_PIN46, OUTPUT);
pinMode (ACTUATOR_PIN48, OUTPUT);
pinMode (ACTUATOR_PIN50, OUTPUT);
pinMode (ACTUATOR_PIN52, OUTPUT);
pinMode (SENSOR_PIN2 , INPUT_PULLUP);
pinMode (SENSOR_PIN3 , INPUT_PULLUP);
pinMode (SENSOR_PIN4 , INPUT_PULLUP);
pinMode (SENSOR_PIN5 , INPUT_PULLUP);
pinMode (SENSOR_PIN6 , INPUT_PULLUP);
pinMode (SENSOR_PIN7 , INPUT_PULLUP);
pinMode (SENSOR_PIN8 , INPUT_PULLUP);
pinMode (SENSOR_PIN9 , INPUT_PULLUP);
pinMode (SENSOR_PIN10 , INPUT_PULLUP);
pinMode (SENSOR_PIN11 , INPUT_PULLUP);
pinMode (SENSOR_PIN12 , INPUT_PULLUP);
pinMode (SENSOR_PIN13 , INPUT_PULLUP);
pinMode (SENSOR_PIN14 , INPUT_PULLUP);
pinMode (SENSOR_PIN15 , INPUT_PULLUP);
pinMode (SENSOR_PIN16 , INPUT_PULLUP);
pinMode (SENSOR_PIN17 , INPUT_PULLUP);
pinMode (SENSOR_PIN23, INPUT);
pinMode (SENSOR_PIN25, INPUT_PULLUP);
pinMode (SENSOR_PIN27, INPUT);
pinMode (SENSOR_PIN29, INPUT);
pinMode (SENSOR_PIN31, INPUT);
pinMode (SENSOR_PIN33, INPUT);
pinMode (SENSOR_PIN35, INPUT);
pinMode (SENSOR_PIN37, INPUT);
pinMode (SENSOR_PIN39, INPUT);
pinMode (SENSOR_PIN41, INPUT);
pinMode (SENSOR_PIN43, INPUT);
pinMode (SENSOR_PIN45, INPUT);
pinMode (SENSOR_PIN47, INPUT);
pinMode (SENSOR_PIN49, INPUT);
pinMode (SENSOR_PIN51, INPUT);
pinMode (SENSOR_PIN53, INPUT);
}
void loop() {
Cayenne.loop();
}
// uscite valide ***********************************************************************************
CAYENNE_IN(VIRTUAL_CHANNEL22)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN22, HIGH);}
else { digitalWrite(ACTUATOR_PIN22, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL24)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN24, HIGH);}
else { digitalWrite(ACTUATOR_PIN24, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL26)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN26, HIGH);}
else { digitalWrite(ACTUATOR_PIN26, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL28)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN28, HIGH);}
else { digitalWrite(ACTUATOR_PIN28, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL30)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN30, HIGH);}
else { digitalWrite(ACTUATOR_PIN30, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL32)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN32, HIGH);}
else { digitalWrite(ACTUATOR_PIN32, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL34)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN34, HIGH);}
else { digitalWrite(ACTUATOR_PIN34, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL36)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN36, HIGH);}
else { digitalWrite(ACTUATOR_PIN36, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL38)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN38, HIGH);}
else { digitalWrite(ACTUATOR_PIN38, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL40)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN40, HIGH);}
else { digitalWrite(ACTUATOR_PIN40, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL42)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN42, HIGH);}
else { digitalWrite(ACTUATOR_PIN42, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL44)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN44, HIGH);}
else { digitalWrite(ACTUATOR_PIN44, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL46)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN46, HIGH);}
else { digitalWrite(ACTUATOR_PIN46, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL48)
{int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN48, HIGH);}
else { digitalWrite(ACTUATOR_PIN48, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL50)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN50, HIGH);}
else { digitalWrite(ACTUATOR_PIN50, LOW);}}
CAYENNE_IN(VIRTUAL_CHANNEL52)
{ int value = getValue.asInt(); if (getValue.asInt() == 1) { digitalWrite(ACTUATOR_PIN52, HIGH);}
else { digitalWrite(ACTUATOR_PIN52, LOW);}}
// Ingressi ********************************************************************
CAYENNE_OUT(VIRTUAL_CHANNEL2)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL2, digitalRead(SENSOR_PIN2));}
CAYENNE_OUT(VIRTUAL_CHANNEL3)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL3, digitalRead(SENSOR_PIN3));}
CAYENNE_OUT(VIRTUAL_CHANNEL4)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL4, digitalRead(SENSOR_PIN4));}
CAYENNE_OUT(VIRTUAL_CHANNEL5)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL5, digitalRead(SENSOR_PIN5));}
CAYENNE_OUT(VIRTUAL_CHANNEL6)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL6, digitalRead(SENSOR_PIN6));}
CAYENNE_OUT(VIRTUAL_CHANNEL7)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL7, digitalRead(SENSOR_PIN7));}
CAYENNE_OUT(VIRTUAL_CHANNEL8)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL8, digitalRead(SENSOR_PIN8));}
CAYENNE_OUT(VIRTUAL_CHANNEL9)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL9, digitalRead(SENSOR_PIN9));}
CAYENNE_OUT(VIRTUAL_CHANNEL10)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL10, digitalRead(SENSOR_PIN10));}
CAYENNE_OUT(VIRTUAL_CHANNEL11)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL11, digitalRead(SENSOR_PIN11));}
CAYENNE_OUT(VIRTUAL_CHANNEL12)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL12, digitalRead(SENSOR_PIN12));}
CAYENNE_OUT(VIRTUAL_CHANNEL13)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL13, digitalRead(SENSOR_PIN13));}
CAYENNE_OUT(VIRTUAL_CHANNEL14)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL14, digitalRead(SENSOR_PIN14));}
CAYENNE_OUT(VIRTUAL_CHANNEL15)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL15, digitalRead(SENSOR_PIN15));}
CAYENNE_OUT(VIRTUAL_CHANNEL16)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL16, digitalRead(SENSOR_PIN16));}
CAYENNE_OUT(VIRTUAL_CHANNEL17)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL17, digitalRead(SENSOR_PIN17));}
CAYENNE_OUT(VIRTUAL_CHANNEL23)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL23, digitalRead(SENSOR_PIN23));}
CAYENNE_OUT(VIRTUAL_CHANNEL25)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL25, digitalRead(SENSOR_PIN25));}
CAYENNE_OUT(VIRTUAL_CHANNEL27)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL27, digitalRead(SENSOR_PIN27));}
CAYENNE_OUT(VIRTUAL_CHANNEL29)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL29, digitalRead(SENSOR_PIN29));}
CAYENNE_OUT(VIRTUAL_CHANNEL31)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL31, digitalRead(SENSOR_PIN31));}
CAYENNE_OUT(VIRTUAL_CHANNEL33)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL33, digitalRead(SENSOR_PIN33));}
CAYENNE_OUT(VIRTUAL_CHANNEL35)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL35, digitalRead(SENSOR_PIN35));}
CAYENNE_OUT(VIRTUAL_CHANNEL37)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL37, digitalRead(SENSOR_PIN37));}
CAYENNE_OUT(VIRTUAL_CHANNEL39)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL39, digitalRead(SENSOR_PIN39));}
CAYENNE_OUT(VIRTUAL_CHANNEL41)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL41, digitalRead(SENSOR_PIN41));}
CAYENNE_OUT(VIRTUAL_CHANNEL43)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL43, digitalRead(SENSOR_PIN43));}
CAYENNE_OUT(VIRTUAL_CHANNEL45)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL45, digitalRead(SENSOR_PIN45));}
CAYENNE_OUT(VIRTUAL_CHANNEL47)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL47, digitalRead(SENSOR_PIN47));}
CAYENNE_OUT(VIRTUAL_CHANNEL49)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL49, digitalRead(SENSOR_PIN49));}
CAYENNE_OUT(VIRTUAL_CHANNEL51)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL51, digitalRead(SENSOR_PIN51));}
CAYENNE_OUT(VIRTUAL_CHANNEL53)
{Cayenne.virtualWrite(VIRTUAL_CHANNEL53, digitalRead(SENSOR_PIN53));}