I need help!

Hello community, I have signed up in Cayenne and I am trying to conect my arduino to Cayenne, but in the step 3 the sketch doesnt appear. Only it says “waiting for board to connect”. But I have made all steps in the correct way and I can´t connect my Arduino. I can not keep moving. Please help me. I don´t know what is happening.

Thank you!

welcome to cayenne community.
are you using ethernet shield to connect arduino to cayenne or a esp8266?

1 Like

Thank you! I am using an ethernet shield W5100 but when I select the option the sketch doesn´t appear. Only appear a message who say: “wating for board to conect” and It doesn´t appear a token like seem the tutorial video only appears MQTT usarnme, MQTT PASSWORD, MQTT CLIENT ID, MQTT SERVER and MQTT port. I don´t know what to do.

on your arduino ide install cayenne MQTT library then in examples you will find example code for w5100 shield connection. add your MQTT credentiala into this code and you will have your board connected.

1 Like

I had this as well. I checked the box for the device, got all MQTT Information but not Sketch came up. I tried this with Firefox, Chrome, IE, Edge. Sometimes it worked, most time not.

Changings on the board settings (in the third Screen) had no effect.

What do you mean by “sometimes it worked most time not?” Do you get past the MQTT screen with all your info on it? or is it stuck on that page with waiting for board to connect on the bottom?

If I am on the page where I can choose the connection type for the controller (third page) I choosed the type - it does ot matter which one - and normally the exmaple sketch for this connection type should came up. But it does not - most time. And it does not matter which browser I tried. Sometimes it worked perfect and if I click in the line with my connection type every time the sketch come up every time.

And yes, I see all my MQTT information and the screen told me “Waiting for board to connect”.

you can also find the code in arduino library and copy your MQTT credential into the code. upload it and the device will get connceted.

Sure. This is a workaround which I was going. But it seems that there is a problem with the Cayenne website, isn´t it?

Hi @Dali9999,
So when you click “Sketch”, nothing happens?

I just tried it now a few times & I get the pop up with the sample code every time.

Hello! I did how you showed me and it works!!
Thank you so much!!! I didn´t know that could happen.

But now my arduino is already connect and I can work on it already!!

make it who he says guys it really works!!

Thank you!!! :smiley:

1 Like

Hello again.
I already connected my arduino to cayenne following the step you told me, but now I am adding relays and it doesn´t work. Only I have added one relay with the sketch that appears but I need add two more and I can´t do it.
It doesn´t appear the pin who I want to use.

Can somebody help me telling me how can I add more actuators??

Hello, thank you for your help!
now I can´t add more actuators because It doesn´t appear “the pin” to configurate it. And if I put the sketch again the relay put before disappears.
How can I add more actuators? because only putting n the buttom " add actuator" doesn´t work.

I don´t understand about channels and why it does´nt appear pins

look at the" step 4 : adding an actuator" in this topic Adding a New Device using MQTT

Hi @atzayacatl-real,

I got your email as well.
Can you post the code you’re using?
Also, what channel settings are you using for each relay on the dashboard?

This can help us understand where the issue may be.

Thanks.
-Jesse

1 Like

Hi @jcruz

Thanks for getting in contact with me.
this is the code I am using with one relay and it works correctly. But the problem is when I add anothe relay because I followed the same steps but the skech doesn´t compile.
I have used the codes that @shramik_salgaonkar told me in his tutorial but doesn´t work with the relay.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %u”, request.channel, getValue.getId(),
getValue.asInt());
switch (request.channel) {
case 1 :
int x = getValue.asInt();
Serial.println(x);
break;
}
}
or this

CAYENNE_IN(1)
{
int x = getValue.asInt();
Serial.println(x);
}
but the new relay doesn´t work. The conection doesn´t work because it doesn´t send the command

this is the code that works but with one relay and I want to add to more


did you add your deice using BYOT ?

No I selected add Arduino.

But I had used once cayenne for a school project and added my device using arduino and the conection was too easy. only my device connected to cayenne using the code to link it and I no longer had to reload anything to the arduino IDE. The devices added them from the dashboard and automatically the arduino s configured and could physically control the relays that were already connected. But before I saw the pins to use and just put the pin in the dasboard and that pin connected the device and the platform connected it alone, I did not have to program in the IDE. Now I have another school project and I thought that the platform continued in the same way, but now I see that they no longer link only the dashboard but every time you want to add an actuator you have to go IDE and program and load the new program to the device.
But what I have not been able to do is connect more relays, because I do not know how to declare the new variables for a new relay since the sketch example is the same and if I change the name to the variable the code no longer compiles, but if not I change it obviously does not compile either because it tells me that they are repeated.

just add your MQTT credentials into this code and upload it. after this add two relay with channel 1 and 2 .

 // 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>

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

unsigned long lastMillis = 0;

void setup() {
	Serial.begin(9600);
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);
}
}
CAYENNE_IN(1)
{
int x = getValue.asInt();
Serial.println(x);
}
CAYENNE_IN(2)
{
int y = getValue.asInt();
Serial.println(y);
}