Can't connect MKr1000

Hi,

Ive copied the example code to connect mkr1000: followed instructions exactly but my device is still showing offline.

I have double checked the device code etc. and network password etc are all correct.

Once connected im trying to add several gas sensors and soil moisture sensors etc for a garden project…

Please help!!

add this at the top of your code and share the serial monitor output #define CAYENNE_DEBUG

You mentioned your device is not getting connected. can you share the code you are using.

//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTMKR1000.h>

/* WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";
*/

char ssid[] = "";
char wifiPassword[] = "";

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

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");
}

serial monitor output?

ive shared the serial monitor line of code and there’s nothing showing on the serial monitor… is that normal?

is the baud rate set to 9600?

yes its set to 9600.

is this the code you are running? i do not see #define CAYENNE_DEBUG added in the code.

#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTMKR1000.h>

/* WiFi network info.
char ssid = “TANGOBAR”;
char wifiPassword = “BARTANGO2019”;
*/

char ssid = “Jay1”;
char wifiPassword = “password1”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “0fdad8c0-a94c-11e9-be3b-372b0d2759ae”;
char password = “640293b3e1c44acf1b959acd4fb182e41c0c41e1”;
char clientID = “055bc950-a950-11e9-be3b-372b0d2759ae”;

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”);
}

Can you amend the code ive sent and paste it so i can test please?? Obviously using my credentials…etc…

Thank you

Run the below code and check if you get any output in the serial monitor.

#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTMKR1000.h>

/* WiFi network info.
char ssid = “TANGOBAR”;
char wifiPassword = “BARTANGO2019”;
*/

char ssid = “Jay1”;
char wifiPassword = “password1”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = "0fdad8c0-a94c-11e9-be3b-372b0d2759ae";
char password = "640293b3e1c44acf1b959acd4fb182e41c0c41e1";
char clientID = "055bc950-a950-11e9-be3b-372b0d2759ae";

void setup() {
Serial.begin(9600);
Serial.println("Starting");
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
Serial.println("Finished");
}

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](https://cayenne.luxwrite/)(2, 700);
[//Cayenne.virtualWrite](https://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”);
}

hi,

now im getting the following error code?

CAYENNE_LOG(“Channel %u, value %s”, request.channel, getValue.asString());

stray ‘\342’ in program

delete all and replace them with "

still nothing showing on serial monitor :frowning:

is the code atleast uploading on your MKR1000?

yes its successfully uploading to mkr1000

Do you get an output of this at least?

void setup() {
  Serial.begin(9600);
Serial.println("setup");
}

void loop() {
Serial.println("loop");
delay("5000");
}

yes “loop” is coming up

can you join me on http://slack.mydevices.com/

trying to… for some reason the confirmation email is taking some time reaching me