-->
Page 1 of 1

Getting my sketch to run

PostPosted: Sat Aug 11, 2018 5:53 pm
by SupDoc
I am using a NODE MCU 1.0 (ESP-12E Module) I have run this sketch dozens of times before and it has worked perfectly. It has always require Port Com 10 to upload. Now I only have two choices Com 3 & Com 11. So I use Com 11 & I can upload the sketch, and I have sensor attached correctly, but it won't run. Nothing appears on the serial monitor not even error messages programmed into the sketch. Here are the control statements at the bottom of the screen:

Archiving built core (caching) in: C:\Users\xxx xxxxxy\AppData\Local\Temp\arduino_cache_745776\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,FlashSize_4M1M,LwIPVariant_v2mss536,Debug_Serial1,DebugLevel_None____,UploadSpeed_115200_dfe81f676089e261bf4e27c5775fe444.a
Sketch uses 263419 bytes (25%) of program storage space. Maximum is 1044464 bytes.
Global variables use 33740 bytes (41%) of dynamic memory, leaving 48180 bytes for local variables. Maximum is 81920 bytes.
Uploading 267568 bytes from C:\Users\xxx xxxxx\AppData\Local\Temp\arduino_build_245698/sketch_aug10a.ino.bin to flash at 0x00000000
................................................................................ [ 30% ]
................................................................................ [ 61% ]
................................................................................ [ 91% ]
...................... [ 100% ]
While this is going on the blue light on the ESP8266 is winking furiously, indicating that it is uploading successfully. I have two questions why has the sketch changed from Com10 Port to Com11 Port in order for it to upload? After running dozens of times before why won't it even communicate with the serial monitor? I have tried 3 different ESP8266's, 4 different sensors, 2 different USB cables, and three nearly similar sketches. I'm beginning to suspect the IDE may be corrupted. Below is the sketch, although I think it is irrelevant to the issue at this point:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <ESP8266WiFi.h>

Adafruit_BMP280 bme; // I2C
int bmpControl = HIGH; // bmpControl is used to select one of two BMPs

/**************************
* S E T U P
**************************/

void setup() {

pinMode(2, OUTPUT);
Serial.begin(9600);

digitalWrite(2, LOW); // selecting BMP 1
Serial.println("doing begin for BMP 1");
if (!bme.begin()) {
Serial.println("Could not find a valid BMP 1 sensor, check wiring!");
while (1);
}

digitalWrite(2, HIGH); // selecting BMP 2
Serial.println("doing begin for BMP 2");
if (!bme.begin()) {
Serial.println("Could not find a valid BMP 2 sensor, check wiring!");
while (1);
}
}

/**************************
* L O O P
**************************/

void loop() {

//every 5 sec
delay(5000);

// change to other BMP
if (bmpControl == LOW) // bmpControl is LOW - change to HIGH
{
bmpControl = HIGH;
Serial.print("BMP 2 *****");
}
else // bmpControl is HIGH - change to LOW
{
bmpControl = LOW;
Serial.print("BMP 1 *****");
}

digitalWrite(2, bmpControl); // write BMP selection control

// do readings
Serial.print("T=");
Serial.print(bme.readTemperature());
Serial.print(" *C");

Serial.print(" P=");
Serial.print(bme.readPressure());
Serial.print(" Pa");

Serial.print(" A= ");
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(" m");

}

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^