W5100 help


#1

hi, I noticed that with arduino and the w5100 cayenne from many problems, type does not load the value of the relays, it is very slow in the response. it is not possible to integrate the triggers, but why did you remove a working and very solid system?

or depends only on the fact that with the legacy 2.0 Arduino one is too “slow” to run the whole thing?
I noticed that the problem with esp8266 does not occur, why?


#2

It usually help if you can post your code so we can take a look at it. Would you mind?

~Benny


#3

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

char username[] =
char password[] = "
char clientID[] = "
#include “DHT.h”
#define DHTPIN 2
#define DHTTYPE DHT22
#define VIRTUAL_PIN 3
#define RELAY_DIGITAL_PIN 3
#define VIRTUAL_PIN2 4
#define VIRTUAL_PIN3 5
#define VIRTUAL_PIN4 6
#define RELAY_DIGITAL_PIN2 4
#define RELAY_DIGITAL_PIN3 5
#define RELAY_DIGITAL_PIN4 6
#define RELAY_DIGITAL_PIN5 7
#define RELAY_DIGITAL_PIN6 8
#define RELAY_DIGITAL_PIN7 9
#define RELAY_DIGITAL_PIN8 10

DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID);
pinMode(RELAY_DIGITAL_PIN, OUTPUT);
pinMode(RELAY_DIGITAL_PIN2, OUTPUT);
pinMode(RELAY_DIGITAL_PIN3, OUTPUT);
pinMode(RELAY_DIGITAL_PIN4, OUTPUT);
pinMode(RELAY_DIGITAL_PIN5, OUTPUT);
pinMode(RELAY_DIGITAL_PIN6, OUTPUT);
pinMode(RELAY_DIGITAL_PIN7, OUTPUT);
pinMode(RELAY_DIGITAL_PIN8, OUTPUT);
dht.begin();
}

void loop() {
Cayenne.loop();

float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) ) {
Serial.println(“Failed to read from DHT sensor!”);
return;

Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print("Temperature: “);
Serial.print(t);
Serial.print(” *C ");

}
Cayenne.virtualWrite(1, h);
Cayenne.virtualWrite(2, t);
Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print("Temperature: “);
Serial.print(t);
Serial.println(” *C ");

}
CAYENNE_IN(3)
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1

// assuming you wire your relay as normally open
if (currentValue == 0) {
digitalWrite(RELAY_DIGITAL_PIN, HIGH);
} else {
digitalWrite(RELAY_DIGITAL_PIN, LOW);
}
}

CAYENNE_IN(4)
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1

// assuming you wire your relay as normally open
if (currentValue == 0) {
digitalWrite(RELAY_DIGITAL_PIN2, HIGH);
} else {
digitalWrite(RELAY_DIGITAL_PIN2, LOW);
}

}
CAYENNE_IN(5)
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1

// assuming you wire your relay as normally open
if (currentValue == 0) {
digitalWrite(RELAY_DIGITAL_PIN3, HIGH);
} else {
digitalWrite(RELAY_DIGITAL_PIN3, LOW);
}

}
CAYENNE_IN(6)
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1

// assuming you wire your relay as normally open
if (currentValue == 0) {
digitalWrite(RELAY_DIGITAL_PIN4, HIGH);
} else {
digitalWrite(RELAY_DIGITAL_PIN4, LOW);
}

}


#4

what error are you getting?


#5

no mistake, the yun stops …
while if I insert the programming in an arduino one stops and just …
same programming in an esp, which is therefore more powerful, goes wonderfully