Access to Adafruit IO from MKR1010

Hello,
I recently bought a MKR WiFi 1010 board. It works well with all examples from the WiFiNiNa library.
I works also well with the ScheduledSSLWebClient sketch since I upgraded the firmware to the last 1.1.0 firmware. (thanks to facchinm & lsaetta65)
So, I try now to upload data from my weather station to Adafruit IO. And the issues came !

This the code I’m using (only one feed):

#include "config.h"
// set up the 'temperature' feed
AdafruitIO_Feed *temperature = io.feed("temperature");
float celsius = 15.0;
void setup() {
  // start the serial connection
  Serial.begin(9600);
  // wait for serial monitor to open
  while(! Serial);
  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();
  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  // we are connected
  Serial.println();
  Serial.println(io.statusText());
}
void loop() {
  io.run();
  celsius = celsius + 1;
  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");
  // save celsius to Adafruit IO
  temperature->save(celsius);
  // wait 5 seconds 
  delay(5000);
}

Following AdafruitIO_WiFI.h call by config.h, libraries used are AdafruitIO_MKR1000 and Adafruit_WINC1500
These libraries call:

#include “Arduino.h”
#include “AdafruitIO.h”
#include “SPI.h”
//#include “WiFi101.h”
#include “WiFiNINA.h”
#include “WiFiSSLClient.h”
#include “Adafruit_MQTT.h”
#include “Adafruit_MQTT_Client.h”

I tried with both (101 & NINA) and have in any case errors:

Error when using WiFi101.h:
C:\Users\papou\Desktop\arduino-nightly\Croquis\libraries\Adafruit_MQTT_Library\Adafruit_MQTT.cpp: In member function ‘bool Adafruit_MQTT_Publish::publish(double, uint8_t)’:
C:\Users\papou\Desktop\arduino-nightly\Croquis\libraries\Adafruit_MQTT_Library\Adafruit_MQTT.cpp:795:35: error: ‘dtostrf’ was not declared in this scope
dtostrf(f, 0, precision, payload);
^
exit status 1
Erreur de compilation pour la carte Arduino MKR WiFi 1010

Error when using WiFiNINA.h:

C:\Users\papou\Desktop\arduino-nightly\Croquis\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_WINC1500.cpp: In member function ‘virtual void AdafruitIO_WINC1500::_connect()’:
C:\Users\papou\Desktop\arduino-nightly\Croquis\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_WINC1500.cpp:42:8: error: ‘class WiFiClass’ has no member named ‘setPins’
WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
^
exit status 1
Erreur de compilation pour la carte Arduino MKR WiFi 1010

Any help would be appreciated !
Regards

AVOID using the NON NINA libraries and examples.
Whilst quite similar in many ways the two are different in many others.
Save yourself from tearing out your hair. :wink:

Go back to basics on your sketch sticking to the NINA examples and principles.

Has the Adafruit lib been confirmed for the MKR1010 ?
With it being a relatively new board ( in all measure of things) thier lib might want updating to take advantage of the MKR1010.

Certainly a question more likely to get an answer on thier forum or thier GITHUB.

oldpapou41:
error: 'dtostrf' was not declared in this scope

Got the same problem, and found a solution.
I know this should not be done, but.
That function is used only once in the Adafruit MQTT library, Adafruit_MQTT.cpp file:

bool Adafruit_MQTT_Publish::publish(double f, uint8_t precision) {
char payload[41]; // Need to technically hold float max, 39 digits and minus sign.
dtostrf(f, 0, precision, payload);
return mqtt->publish(topic, payload, qos);
}

Since I don't use that function in my sketch, I commented out the "dtostrf" line, and now the sketch compile and works fine (for my purpose).
(don't know how to make this using the online sketch editor, so I moved to the offline editor and downloaded the lib)

Also noticed that in the same file, first lines, is written this:

#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000)
static char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
char fmt[20];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(sout, fmt, val);
return sout;
}
#endif

This can solve our problem, but, before I edited the library file, I've tried to define a symbol ARDUINO_SAMD_MKR1000 in my sketch (before including the library), but it won't compile anyway.
If anyone can help on this....

Roberto