Getting Null as output no matter using serial communication!

i was using esp32 board and wanted to print stuff out and i am getting null as output when there’s a message from esp32

i don’t know what to do

this is my program

#include <Arduino.h>
#define DELAY 1000
#define LED_BUILTIN 1

void setup() {
  Serial.begin(115200);
  Serial.println("inited from setup");
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(921600);
  Serial.println("Hello from the setup");
}

void loop() {
  delay(DELAY);
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println("Hello from the loop");
  delay(DELAY);
  digitalWrite(LED_BUILTIN, LOW);
}

below is my platform.ini file

[env:denky32]
platform = espressif32
board = denky32
framework = arduino
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0

You are trying to initialize Serial twice!

Remove these lines:

Make sure your platformio.ini has
monitor_speed = 115200

If you still have issues, please also show the content of your platformio.ini

oh hey there thanks for the reply forgot to add the platform.ini
here it is

[env:denky32]
platform = espressif32
board = denky32
framework = arduino
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0 

btw i saw a previous thread (Noob stuck on ESP32-CAM+MB with PIO/vscode)
so therefore added the two lines below but no luck ( still having same issues)

Did you remove the 2nd initialization?

yes i did remove that


void setup() {
  Serial.begin(115200);
  Serial.println("inited from setup");
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.println("Hello from the setup");
}

this is the new setup function

oh hey btw i just noticed one more thing

i’m getting an error while doing pio device monitor

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4
E (94) psram: PSRAM ID read error: 0xffffffff
in␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀

this is the entire output the null you see at the end is the exact output i’m getting
and above that i’m also getting a read error 0xffff…

The denky32 board should have psram. Looks like your board don’t. Do you really have a denky32?

Otherwise please use the default:
board = esp32dev

i have esp32-wroom-32 written on the board i tried the option esp32dev as well

but got it finally working i searched on internet
and found out that the pin 1 is used for serial communication so it was causing issues

i changed the pin to 2 and i’m getting no errors with serial output as of now however i’m not sure which board i’m using

also i’m not sure what do i put in the pio project init --board

i want to get to a point where i can read a datasheet to understand things and test programs out

thanks a lot for helping me throughout the day thanks to you i got the serial communication working

1 Like

Post a picture or a link to your board

this is i believe the exact board that i have
below is an image as well

i took the below image at my house btw

That’s an ESP32-DevKitC-1.
Use board = esp32dev

A good reference for the PIN’s you can use is located here:

Hey thanks a lot for this
platform io does provide using esp-idf

would you say that would be a better option ??

i’m very very new to embedded programming but i saw things like esp_schedule and handle_event these things seem very powerful compared to normal execution of arduino framework programs

do you have any good project idea for esp32

The more professional way is esp-idf because you have more control.
Arduino has some fixed settings and library that cannot be changed easily.

For a better learning, since you said you are new to this, would be Arduino. A lot of libraries are available. There is a great Arduino community out there.
The good thing is, you can use (mostly) all underlying ESP-IDF and FreeRTOS things in an Arduino sketch. There is nothing prevent you to start a new FreeRTOS task in Arduino (xTaskCreate(...)) for example.

There is also a way of mixing ESP-IDF and Arduino: Arduino as ESP-IDF Component (framework = espidf, arduino)

My opinion: If you project is for hobby: use Arduino / if it is for business, use ESP-IDF.

1 Like

oh i see mostly my projects are hobby based but my programs are quite demanding i mean i’m trying to run an ssh server on esp32

so people told me using esp-idf is the only option will try and test things

i want to create something like ssh terminal.shop interface for my esp32

they’ve used go but i’ll have to use C or C++
so it’ll be pretty fun to make ig idk

i’ve got basic stuff done

do you think i can create this with arduino framework?

There is an ESP32 Arduino ssh server library available:

Arduino is C++, ESP-IDF is C / C++

Yes - See the library above.

The discussion has gone off-topic and should be continued elsewhere.