Esp8266 wemos d1 resets when setting pin 8 or 6 or 7 or 5 to output

Hi i got an esp8266 d1 and when trying to set digital pin 8, 6, 5, or 7 it resets with this


wdt reset
load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v00045e90

and when trying to digitalWrite pin 3 or 4 it resets with


load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v00045ed0

here is my code

/**************************************************************************
  This is an example for our Monochrome OLEDs based on SSD1306 drivers

  Pick one up today in the adafruit shop!
  ------> http://www.adafruit.com/category/63_98

  This example is for a 128x32 pixel display using I2C to communicate
  3 pins are required to interface (two I2C and one reset).

  Adafruit invests time and resources providing this open
  source code, please support Adafruit and open-source
  hardware by purchasing products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries,
  with contributions from the open source community.
  BSD license, check license.txt for more information
  All text above, and the splash screen below must be
  included in any redistribution.
 **************************************************************************/

#include <NTPClient.h>
// change next line to use with another board/shield
#include <ESP8266WiFi.h>
//#include <WiFi.h> // for WiFi shield
//#include <WiFi101.h> // for WiFi 101 shield or MKR1000
#include <WiFiUdp.h>

const char *ssid     = "wifi";
const char *password = "pass";

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library.
// On an arduino UNO:       A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO:   2(SDA),  3(SCL), ...
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
WiFiUDP ntpUDP;

NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600 * 2, 60000);


void setup() {
  pinMode(8, OUTPUT);
  
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println(F("Tiny Clock"));
  display.display();
  delay(1000);
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("connecting... ");
  display.display();
  WiFi.begin(ssid, password);

  while ( WiFi.status() != WL_CONNECTED ) {
    display.clearDisplay();
    display.setCursor(0, 0);
    display.println("connecting... ");
    display.display();
  }
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("connected");
  display.display();
  delay(500);
  display.clearDisplay();
  display.display();
  timeClient.begin();

}

void loop() {
  display.setCursor(15, 10);
  timeClient.update();
  display.setTextSize(2.5);
  display.println(timeClient.getFormattedTime());
  display.display();
  delay(500);
  display.clearDisplay();

}

if i remove the pinMode(8, OUTPUT); then it works perfectly

solved the d1 mini does not use the pin numbers that are printed on to the board and pin 8 is connected to the spi flash

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.