I’m using the MKR1000 in combination with the Arduino library to connect to Thinger, however the sample sketch doesn’t seem to work over SSL.
I’m using the code below (credentials have been removed);
//#define _DISABLE_TLS_
#define _DEBUG_
#include <WiFi101.h>
#include <ThingerWifi101.h>
#define USERNAME "tvervest"
#define DEVICE_ID "MKR1000"
#define DEVICE_CREDENTIAL "device credential"
#define SSID "wlan name"
#define SSID_PASSWORD "wlan password"
#define LED_PIN LED_BUILTIN
ThingerWifi101 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("Connected to serial");
// configure wifi network
thing.add_wifi(SSID, SSID_PASSWORD);
pinMode(LED_PIN, OUTPUT);
// pin control example (i.e. turning on/off a light, a relay, etc)
thing["led"] << digitalPin(LED_PIN);
// resource output example (i.e. reading a sensor value, a variable, etc)
thing["millis"] >> outputValue(millis());
// more details at http://docs.thinger.io/arduino/
}
void loop() {
thing.handle();
}
The resulting serial output is
Connected to serial
[NETWORK] Starting connection...
[NETWORK] Connecting to network squarewlan
[NETWORK] Connected to WiFi!
[NETWORK] Getting IP Address...
[NETWORK] Got IP Address: 3585255616
[NETWORK] Connected!
[_SOCKET] Connecting to iot.thinger.io:25202...
[_SOCKET] Using secure TLS/SSL connection: yes
[_SOCKET] Error while connecting!
[_SOCKET] Connecting to iot.thinger.io:25202...
[_SOCKET] Using secure TLS/SSL connection: yes
[_SOCKET] Error while connecting!
(....etc)
However, if I uncomment the DISABLE_TLS define everything works as expected. I’ve already added the root certificate for iot.thinger.io to the WiFi module, but I’m not sure if that’s the issue. Any suggestions would be greatly appreciated!