Hello dear Arduino Community,
I hope this topic is in the right Forum part.
My problem:
Recently I bought an ESP32 and tested it with the Blink - Test provided in the Examples. When I want to output some value in the Serial monitor, the Serial Monitor stays blank.
I discovered that when I disconnect and reconnect the USB - cable from the ESP to the Laptop the Serial Monitor shows what it is supposed to show.
To simplify the test, I just tried a "Hello World" example, but the same problem occurs.
Long way short, the Serial Monitor just outputs anything after the device is disconnected and reconnected.
Here I will show you the first code I used, and afterwards the "Hello - World " sketch.
Maybe someone has any idea how to solve that.
I would be really grateful.
int vibr_Pin = 4;
int LED_Pin = 2;
void setup(){
Serial.begin(115200); //init serial 9600
pinMode(LED_Pin, OUTPUT);
pinMode(vibr_Pin, INPUT); //set vibr_Pin input for measurment
// Serial.println("----------------------Vibration demo------------------------");
}
void loop(){
long measurement =TP_init();
delay(50);
// Serial.print("measurment = ");
Serial.println(measurement);
if (measurement > 1000){
digitalWrite(LED_Pin, HIGH);
}
else{
digitalWrite(LED_Pin, LOW);
}
}
long TP_init(){
delay(10);
long measurement=pulseIn (vibr_Pin, HIGH); //wait for the pin to get HIGH and returns measurement
return measurement;
}
The "Hello - World sketch":
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Hello World");
delay(5000);
}