Hi, i have a Problem with my ESP32-S3 WROOM-1.
Im trying to Get the Serial Monitor working but It wont.
Next my Spezifications:
Board: ESP32-S3 WROOM-1 n16r8
The Docs.: ESP32-S3-DevKitC-1 v1.1 - ESP32-S3 - — esp-dev-kits latest documentation
IDE: Vscode with PlatformIO
OS: Manjaro Linux Latest Version
Hardware: Lenovo Ideapad 3, Ryzen 7 5700U, 16GB Ram, Radeon Graphics.
The .ini:
[env:esp32-s3-devkitc-1-n16r8v]
platform = espressif32
board = esp32-s3-devkitc-1-n16r8v
framework = arduino
monitor_speed = 115200
lib_deps =
Adafruit_NeoPixel
So. I can Upload my Code via the USB C COM-Port and IT works fine. But when i unplug It and trying to use the UART-USB for the SerialMonitor It wont Work.
Error 2 during Upload. Cannot find the Upload-Port.
I Also have Tryed the issue fixes in the Documentation. I added my User to the “uucp” group and i also checked all Ports with "ls /dev/tty* " but the Port still Not appears.
Then i Tryed to reset the Board with the USB-C COM-Port, and plugged It Out to Plug in the cable in the UARt-USB Port and start IT with boot.
Still Not working…
I Tryed every Port i have.
This is my Project. I want to make a car that can Drive around obstacles. Yes there are Better ways to do It, i also could by a kit where is everything given also a 1 by 1 Manual but i wont. Because thats Not the lern effect i want.
Maybe you Guys can Help me i asked in multiple Groups but Sometimes No one answeres otherwise they could Not solve the Problem and sayed i should ask Here!
Thank you very much, and im so sorry for my Bad english, im still learning.
Here is the Code:
#include <Arduino.h>
// Sensor front
#define trigPin1 6
#define echoPin1 7
// Sensor right
#define trigPin2 40
#define echoPin2 39
// Sensor left
#define trigPin3 8
#define echoPin3 18
// engine A
#define motorPin1 20
#define motorPin2 21
// engine B
#define motorPin3 11
#define motorPin4 10
// define sound speed in cm/uS
#define SOUND_SPEED 0.034
#define CM_TO_INCH 0.393701
long durationFront;
long durationRight;
long durationLeft;
float distanceCmFront;
float distanceCmRight;
float distanceCmLeft;
void setup() {
Serial.begin(115200); // Starts the serial communication
Serial.print("PROGRAM START");
pinMode(trigPin1, OUTPUT); // Set the trigPin1 as an Output
pinMode(echoPin1, INPUT); // Set the echoPin1 as an Input
pinMode(trigPin2, OUTPUT); // Set the trigPin2 as an Output
pinMode(echoPin2, INPUT); // Set the echoPin2 as an Input
pinMode(trigPin3, OUTPUT); // Set the trigPin3 as an Output
pinMode(echoPin3, INPUT); // Set the echoPin3 as an Input
pinMode(motorPin1, OUTPUT); // Set the enginePin1 as an Output
pinMode(motorPin2, OUTPUT); // Set the enginePin2 as an Output
pinMode(motorPin3, OUTPUT); // Set the enginePin3 as an Output
pinMode(motorPin4, OUTPUT); // Set the enginePin4 as an Output
}
enum motor_state { // This is a list with all different states for the motor
MOTOR_STATE_FORWARD,
MOTOR_STATE_BACKWARD,
MOTOR_STATE_STOP,
TURN_RIGHT,
TURN_LEFT,
TURN_AROUND,
UTURN,
};
void change_motor_state(enum motor_state state){ // With this function will the Motor be controlled
switch (state) {
case MOTOR_STATE_FORWARD: // Let the car drive forward
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
break;
case MOTOR_STATE_BACKWARD: // Let the car drive backwards
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
break;
case MOTOR_STATE_STOP: // Stops the car
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
break;
case TURN_RIGHT: // 90 degrees turn to the right
digitalWrite(motorPin1,LOW);
digitalWrite(motorPin2,HIGH);
digitalWrite(motorPin3,HIGH);
digitalWrite(motorPin4,LOW);
delay(2000);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
}
float calc_sensor_front(){ // This function reads the distance in front of the car in cm
digitalWrite(trigPin1, LOW); // Clears the TriggerPin
delayMicroseconds(2);
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
durationFront = pulseIn(echoPin1, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds
// Calculate the distance
distanceCmFront = durationFront * SOUND_SPEED/2;
// Prints the distance in the Serial Monitor
Serial.print("Distance_Front (cm): ");
Serial.println(distanceCmFront);
delay(1000);
return distanceCmFront; // The return gives me the different distances in front of the car
}
float calc_sensor_right(){ // This function reads the distance on the right of the car in cm
digitalWrite(trigPin2, LOW); // Clears the TriggerPin
delayMicroseconds(2);
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin2, LOW);
durationRight = pulseIn(echoPin2, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds
// Calculate the distance
distanceCmRight = durationRight * SOUND_SPEED/2;
// Prints the distance in the Serial Monitor
Serial.print("Distance_Right (cm): ");
Serial.println(distanceCmRight);
delay(1000);
return distanceCmRight; // This return gives me the different distances on the right of the car
}
float calc_sensor_left(){ //This function reads the distance on the left of the car in cm
digitalWrite(trigPin3, LOW); // Clears the TriggerPin
delayMicroseconds(2);
digitalWrite(trigPin3, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin3, LOW);
durationLeft = pulseIn(echoPin3, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds
// Calculate the distance
distanceCmLeft = durationLeft * SOUND_SPEED/2;
// Prints the distance in the Serial Monitor
Serial.print("Distance_Left (cm): ");
Serial.println(distanceCmLeft);
delay(1000);
return distanceCmLeft; // This return gives me the different distances on the left of the car
}
void loop() {
Serial.print("PROGRAM START");
change_motor_state(MOTOR_STATE_FORWARD); // Starting the Motor Forward
// TEST BEGIN
digitalWrite(trigPin1, LOW); // Clears the TriggerPin
delayMicroseconds(2);
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
durationFront = pulseIn(echoPin1, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds
// Calculate the distance
distanceCmFront = durationFront * SOUND_SPEED/2;
// Prints the distance in the Serial Monitor
Serial.print("Distance_Front (cm): ");
Serial.println(distanceCmFront);
delay(1000);
// TEST END
// TEST BEGIN
/*if (sensorFront <= 50) {
change_motor_state(MOTOR_STATE_STOP);
}
else if(sensorLeft <= 50 && sensorRight <= 50 && sensorFront <= 50) {
change_motor_state(MOTOR_STATE_STOP);
} */
}