This setup works fine using the WifiNINA library, set up as follows:
- Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include <WiFiNINA.h>
// Configure the pins used for the ESP32 connection
#define SPIWIFI SPI // The SPI port
#define SPIWIFI_SS 10 // Chip select pin
#define ESP32_RESETN 6 // Reset pin
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
#define ESP32_GPIO0 -1
But when I try the adafruitio_00_publish example, the io.statusText() is "Network disconnected".
I'd appreciate any ideas, comments, or things to try.
Here is the adafruitio_00_publish config.h, showing the pin assignments:
- Code: Select all | TOGGLE FULL SIZE
// uncomment the following line if you are using airlift
#define USE_AIRLIFT
// uncomment the following line if you are using winc1500
// #define USE_WINC1500
// comment out the following lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"
#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || \
defined(ADAFRUIT_PYPORTAL)
// Configure the pins used for the ESP32 connection
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
// Don't change the names of these #define's! they match the variant ones
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define NINA_ACK 9 // a.k.a BUSY or READY pin
#define NINA_RESETN 6 // Reset pin
#define NINA_GPIO0 -1 // Not connected
#endif
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS,
NINA_ACK, NINA_RESETN, NINA_GPIO0, &SPIWIFI);
#else
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
#endif
Here is the main code from the example, which I haven't changed:
- Code: Select all | TOGGLE FULL SIZE
// this int will hold the current count for our sketch
int count = 0;
// set up the 'counter' feed
AdafruitIO_Feed *counter = io.feed("counter");
void setup() {
// start the serial connection
Serial.begin(115200);
// wait for serial monitor to open
while(! Serial);
Serial.println(" ");
Serial.println("Connecting to Adafruit IO");
// connect to io.adafruit.com
io.connect();
// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.println(io.statusText());
delay(500);
}
// we are connected
Serial.println();
Serial.println(io.statusText());
}
void loop() {
// io.run(); is required for all sketches.
// it should always be present at the top of your loop
// function. it keeps the client connected to
// io.adafruit.com, and processes any incoming data.
io.run();
// save count to the 'counter' feed on Adafruit IO
Serial.print("sending -> ");
Serial.println(count);
counter->save(count);
// increment the count by 1
count++;
// Adafruit IO is rate limited for publishing, so a delay is required in
// between feed->save events. In this example, we will wait three seconds
// (1000 milliseconds == 1 second) during each loop.
delay(3000);
}