Using WiFi, LCD, and encoder

I'm trying to do a project where I am using a the built in wifi, Adafruit LCD (Standard LCD 16x2 + extras [white on blue] : ID 181 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits), and a rotary encoder. My issue is that I cant seem to use any combination of pins that allow me to use all of these devices, and I can not seem to find the pinout data for the wifi radio. Does it touch any of the MKR1000s externally accessible pins? Am I barking up the wrong tree? The WiFi works when I disable the encoder and LCD, and the LCD and Encoder work either way. Currently I'm starting the encoder and LCD with the following lines, but I've tried nearly every combination I can think of.

Encoder myEnc(4, 5);
LiquidCrystal lcd(6, 3, 7, 1, 0, 2);

You really need to post ALL your code but PLEASE PLEASE USE CODE TAGS.

Not many of us using the MKR but we are lucky to have a couple of mods and developer gurus in this section.

OK, Sure. The code never gets past the initWiFi call in the setup phase. Specifically it hangs at WiFi.begin(ssid, pass) != WL_CONNECTED.

#include <Encoder.h>
#include <LiquidCrystal.h>
#include <WiFi101.h>
#include <WiFiSSLClient.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#include <AzureIoTHub.h>
#include "simplesample_http.h"

char ssid[] = "*************";
char pass[] = "*************";
long oldPosition  = -9999;

Encoder myEnc(4, 5);
LiquidCrystal lcd(6, 3, 7, 1, 0, 2);

WiFiSSLClient sslClient;

AzureIoTHubClient iotHubClient(sslClient);


void setup() {
  initSerial();
  initWifi();
  initTime();
  iotHubClient.begin();
}

void loop() {
  encoderUpdate();
  simplesample_http_run(); 
}

void initSerial() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect.
  }
}

void initWifi() {

  // check for the presence of the shield :
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  // attempt to connect to Wifi network:
  Serial.print("Attempting to connect to SSID: ");
  Serial.println(ssid);

  // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
  while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
    // unsuccessful, retry in 4 seconds
    Serial.print("failed ... ");
    delay(4000);
    Serial.print("retrying ... ");
  }

  Serial.println("Connected to wifi");
}

Hi @slashy42,

The WINC1500 pins are connected internally to the SAMD21 within the ATSAMW25 module.

See variants/mkr1000/variant.h in the SAMD core for more info:

#define WINC1501_RESET_PIN   (30u)
#define WINC1501_CHIP_EN_PIN (31u)
#define WINC1501_INTN_PIN    (33u)
#define WINC1501_SPI         SPI1
#define WINC1501_SPI_CS_PIN  PIN_SPI1_SS

Maybe your issue is not all pins are interrupt enabled? See the attachInterrupt() reference for more info.

Have you tried a sketch with just the Encoder and LCD? It could be the board is running out of RAM as well.

Yep, Encoder and LCD alone work just fine. The only pins that need an interrupt are the encoder's, and they are on pins with interrupts.

Ram had not crossed my mind. Is there an easy way to check for that?

Edit: Forgot to thank you for answering the question about the WiFi pins! That's a big help!

I did some more excluding, and it works with the LCD enabled, but not when the encoder is enabled.