Go Down

Topic: Any reason why I wouldn't be able to connect to IoT Cloud? (Read 1 time) previous topic - next topic

Weavermech

I have a MKR1000, up to date firmware as far as I can tell, I did the potentiometer part of the Getting Started tutorial, adding a line to output to the serial monitor, so I know that works, but get nothing on my dashboard.

 My serial bus output is as follows, with ... inserted where there is repetition of the time, analogue pin, and so on..

Code: [Select]






381
390
387
::CONNECTING
WiFi.status(): 3
Connected to "MyWiFi"
309



381
347
NetworkConnectionState::GETTIME
Arduino IoT Cloud Connection status: CONNECTING
343
NTP time: 1573819829
ArduinoCloud.connect(): 0
311
NTP time: 1573819830
ArduinoCloud.connect(): 0



299
NTP time: 1573819848
ArduinoCloud.connect(): 0
303
WiFi.status(): 3
Connected to "MyWiFi"
NTP time: 1573819850
ArduinoCloud.connect(): 0



297
NTP time: 1573819869
ArduinoCloud.connect(): 0
311
WiFi.status(): 3
Connected to "MyWiFi"


And this continues. I can upload sketches to the board fine, and the monitor shows the value at the analogue pin changing, but it's not connecting to the Arduino IoT Cloud. Any advice on what to check or even hints on how to debug this further?

My .ino :
Code: [Select]
#include "thingProperties.h"


void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500);

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
 
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you'll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(4);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  angle1 = analogRead(A0);
  Serial.println(angle1);
 
}



and thingProperties.h :

Code: [Select]
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>


const char THING_ID[] = "fd895cd9-9496-41aa-9365-e983ebc4d2ed";

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)


int angle1;

void initProperties(){

  ArduinoCloud.setThingId(THING_ID);
  ArduinoCloud.addProperty(angle1, READ, 1 * SECONDS, NULL);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

ubidefeo

hi

can you try and add a delay(5000) before ArduinoCloud.printDebugInfo(); ?

also... did you go through the Arduino IoT Cloud Getting Started guide to provision your board?
try going through it again just to be sure, then select the board in your Thing's board tab.

https://create.arduino.cc/getting-started

Weavermech

Hiya,

 Yep, that did the trick, many thanks! I feel like I did do Getting Started the first time, but maybe something went wrong and I didn't realise  ::)

Onwards!!

Go Up