Ok… Time to put this one to rest i think… i don’t feel like downloading programming software and learning how to create header files. I’ll just use Blynk or another IoT platform.
Thanks for the help… by the way, @farmsensors.iot… Arduino themselves supports your hardware for secure and cloud connection to control and monitor data from the Nano 33 IoT… unless you already knew this and did not like the presentation, etc…
Hello all, I have one nano 33 Iot , and I’m trying to make a project with Cayenne, I’m using CayenneMQTTUnoWifiRev2.h and I can see in Cayenne dashboard that I have connection.
Problem : it looks that the code in arduino stops in the instruction “Cayenne.begin(username, password, clientID, ssid, wifiPassword);”
The void loop isn’t executed any time, and after 2 or 3 minutes the connection with Cayenne goes off.
( I also didn’t get any data in Cayenne )
Thanks in advance
It compiles and download ok, I have put some log like this :
CAYENNE_LOG(“Connected -1”)
CayenneMQTTSubscribe(&_mqttClient, NULL, COMMAND_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
CAYENNE_LOG(“Connected -2”)
and I get the message connected -1
but not the connected -2
You need to first initialize the connection to the server and then subscribe to all the MQTT channels and topics.
Can you use this example
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTUnoWifiRev2.h>
// WiFi network info.
char ssid[] = "ssid";
char wifiPassword[] = "wifiPassword";
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";
void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}
void loop() {
Cayenne.loop();
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
// 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);
}
// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}
Has anyone solved this, I feel like I’m getting the exact same issues as everyone above has mentioned, but can’t find any solutions online.
EDIT: To give more context, I have a Nano 33 IoT and can’t get any connection working and I’ve tried all of the example codes and none of them work. I have also reinstalled everything multiple times, but still nothing works. I also get the same issue above, which seems to render the unit useless. If I put any code in the loop it won’t work. I feel like ive tried eveything and it just doesnt work. I have also tested the unit with other code including code to test the Wi-Fi and it is working when I do that…