Need Help, can,t find other conectivity


#1

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

  • Device & model you are using ( Arduino Uno with W5100 ethernet shield)

  • What dashboard are you using? (Web, Android)

  • Please describe the bug / issue as detailed as possible. Attaching the code and any relevant screenshots would be very helpful!


    Hi everyone, need help why I can’t find other conectivity option, just virtual can choose.


#2

You will need to select Custom Widget>Button instead of Actuators>Light to get other options.


#3

Thank u for the fast response. But I have some problem again. How to add another LED button, I’ve try it but it seem overwrite the old one.


#4

did you try this ? :


#5

Yes, but does’nt work


#6

you have to select different channel for each button and then add code to read each button:
select channel 1 for led 4 button and channel 2 for led 5 button.

CAYENNE_IN(1) // Get current value of led 4 button
{
int x = getValue.asInt();
digitalWrite(led_4_pin, x);
}
CAYENNE_IN(2) // Get current value of led 5 button
{
 int x1 = getValue.asInt();
digitalWrite(led_5_pin, x1);

}

#7

Hi, thanks for the answer, can you please show the entire code?


#8
// This example shows how to connect to Cayenne using an Ethernet W5100 shield and send/receive sample data.

//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTEthernet.h>

#define led_4_pin 6
#define led_5_pin 7

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


unsigned long lastMillis = 0;

void setup() {
  Serial.begin(9600);
  pinMode(led_4_pin, OUTPUT);
  pinMode(led_5_pin, OUTPUT);
  Cayenne.begin(username, password, clientID);
}

void loop() {
  Cayenne.loop();

  //Publish data every 10 seconds (10000 milliseconds). Change this value to publish at a different interval.
  if (millis() - lastMillis > 10000) {
    lastMillis = millis();
    //Write data to Cayenne here. This example just sends the current uptime in milliseconds.
    Cayenne.virtualWrite(0, lastMillis);
    //Some examples of other functions you can use to send data.
    //Cayenne.celsiusWrite(1, 22.0);
    //Cayenne.luxWrite(2, 700);
    //Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
  }
}

CAYENNE_IN(1) // Get current value of led 4 button
{
  int x = getValue.asInt();
  digitalWrite(led_4_pin, x);
}
CAYENNE_IN(2) // Get current value of led 5 button
{
  int x1 = getValue.asInt();
  digitalWrite(led_5_pin, x1);

}

#9

Thank you, its work. You’re the best.


#10

great to hear that.add a resistor between the led and pin. now you can start with much advance projects using cayenne.


#11

OK, still need your help in the future.