Hi, RD back and puzzled,
I was able to run a basic blink sketch on my ESP32C3 (insert cheering and applause) but a slightly more complex sketch delivers a whole bunch of information that I do not understand related to why this is not working. Long story short, no serial data was received.
Would someone examine the code and, more importantly, the error messages and give me your best shot at why the serial data is not flowing. I am posting the code below and the error messages below the code. Thank you so much for even considering this issue.
BTW, this is a simple sketch designed to read the humidity, temperature, and atmospheric pressure from the BME280 and display it on the SSD1306.
[code]
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define SCREEN_ADDRESS 0x3C // Change this address to match your display
Adafruit_BME280 bme; // Create a BME280 sensor object
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// Initialize I2C communication
Wire.begin();
// Initialize BME280 sensor
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
// Initialize OLED display
Serial.println(F("SSD1306 allocation failed"));
display.display(); // Clear the display buffer
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,0);
display.println("BME280 Data:");
display.display(); // Display the header
delay(1000); // Pause for a moment
}
void loop() {
// Read sensor data
float temperature = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = bme.readPressure() / 100.0F;
// Display sensor data on OLED
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.print("Temperature: ");
display.println(temperature, 2);
display.print("Humidity: ");
display.println(humidity, 2);
display.print("Pressure: ");
display.print(pressure, 2);
display.println(" hPa");
display.display(); // Show updated data on the display
delay(2000); // Update every 2 seconds
}
[/code]
Sketch uses 329790 bytes (25%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14580 bytes (4%) of dynamic memory, leaving 313100 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM4
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:85:18:07:c8:3c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
A fatal error occurred: No serial data received.
A fatal error occurred: No serial data received