Virtual numeric keypad

HI Shramik. I tried the code (the one I asked you if it will work). For reasons that I don’t know it didn’t work. Dunno what I’ve been doin’ wrong. I thought of another approach and this time I will use the status of the widget (whether it’s on or off) in my if statement.

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMQTTEthernet.h>

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";

#define VIRTUAL_CHANNEL_2 2
#define ACTUATOR_PIN_2 2 
#define VIRTUAL_CHANNEL_3 3
#define ACTUATOR_PIN_3 3 
#define VIRTUAL_CHANNEL_4 4
#define ACTUATOR_PIN_4 4 
#define VIRTUAL_CHANNEL_5 5
#define ACTUATOR_PIN_5 5 
#define VIRTUAL_CHANNEL_6 6
#define ACTUATOR_PIN_6 6 
#define VIRTUAL_CHANNEL_7 7
#define ACTUATOR_PIN_7 7 
#define VIRTUAL_CHANNEL_8 8
#define ACTUATOR_PIN_8 8 
#define VIRTUAL_CHANNEL_9 9
#define ACTUATOR_PIN_9 9

void setup()
{
	Serial.begin(9600);
  pinMode(ACTUATOR_PIN_2, OUTPUT);
  pinMode(ACTUATOR_PIN_3, OUTPUT);
  pinMode(ACTUATOR_PIN_4, OUTPUT);
  pinMode(ACTUATOR_PIN_5, OUTPUT);
  pinMode(ACTUATOR_PIN_6, OUTPUT);
  pinMode(ACTUATOR_PIN_7, OUTPUT);
  pinMode(ACTUATOR_PIN_8, OUTPUT);
  pinMode(ACTUATOR_PIN_9, OUTPUT);
  pinMode(13, LOW);
	Cayenne.begin(username, password, clientID);
}

void loop()
{
Cayenne.loop();
if (VIRTUAL_CHANNEL_2 == HIGH &&
    VIRTUAL_CHANNEL_3 == HIGH &&
    VIRTUAL_CHANNEL_4 == HIGH &&
    VIRTUAL_CHANNEL_5 == HIGH &&
    VIRTUAL_CHANNEL_6 == LOW &&
    VIRTUAL_CHANNEL_7 == LOW &&
    VIRTUAL_CHANNEL_8 == LOW &&
    VIRTUAL_CHANNEL_9 == LOW) 
{
    digitalWrite(13,HIGH);
    }
else 
{
    digitalWrite(13,LOW);
}
}

// This function is for button 2.
CAYENNE_IN(2)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_2, ACTUATOR_PIN_2, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_2, value);
}

// This function is for button 3.
CAYENNE_IN(3)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_3, ACTUATOR_PIN_3, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_3, value);
}

// This function is for button 4.
CAYENNE_IN(4)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_4, ACTUATOR_PIN_4, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_4, value);
}

// This function is for button 5.
CAYENNE_IN(5)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_5, ACTUATOR_PIN_5, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_5, value);
}

// This function is for button 6
CAYENNE_IN(6)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_6, ACTUATOR_PIN_6, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_6, value);
}

// This function is for button 7.
CAYENNE_IN(7)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_7, ACTUATOR_PIN_7, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_7, value);
}

// This function is for button 8.
CAYENNE_IN(8)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_8, ACTUATOR_PIN_8, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_8, value);
}


// This function is for button 9.
CAYENNE_IN(9)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL_9, ACTUATOR_PIN_9, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN_9, value);
}

What do u think? Will this one work?