hi guys i am new to arduino and my issue is that i have a clone uno and made a project for lifting up of bridge when water is detechted and it worked but later just to set the servo motors to 0 position i changed the code and while uploading it i got this error
Port monitor error: command 'open' failed: Serial port not found. Could not connect to COM3 serial port
later my board is blinking with red led that indicates pwr and it is not even visible in the device manager and also the port option is disabled
here is the code and the screen shot can you guys please help me
#include <Servo.h> //Importing Servo Library To Controll The Servo Motors
#define soilMoistureSensorPin A0 // Analog Pin For Soil Moisture Sensor
#define servoPin1 9 // Digital Pin For Servo 1
#define servoPin2 10 // Digital Pin For Servo 2
// Define servo positions (in degrees)
const int BridgeLoweredPosition = 0; // Angle Of Servo Head When Bridge Is Lowered
const int BridgeRaisedPosition = 90; // Angle Of Servo Head When Bridge Is Lifted
Servo servo1; //Define Servo1
Servo servo2; //Define Servo2
void setup() {
Serial.begin(9600); //Initialising Serial Monitor
servo1.attach(servoPin1); //Defined Pin PORT
servo2.attach(servoPin2); //Defined Pin PORT
Serial.println("bridgeactive"); // Printing To Serial Monitor
}
void loop() {
int sensorValue = analogRead(soilMoistureSensorPin); // Reading Value From The Sensor
int moisturePercent = map(sensorValue, 1023, 0, 0, 100); // Map the sensor value to a more readable range (0-100)
Serial.print("Moisture: "); // Printing The Value to Serial Monitor
Serial.println(moisturePercent); // Printing The Value to Serial Monitor
if (moisturePercent == 0 ){ //When Water Is NOT Detected
servo1.write(BridgeLoweredPosition); // Set servo position
servo2.write(BridgeLoweredPosition); // Set servo position
}
else if (moisturePercent > 0){ //When Water Is Detected
servo1.write(BridgeRaisedPosition); // Set servo position
servo2.write(BridgeRaisedPosition); // Set servo position
}
delay(2000); //To Stop From Repeatedly Checking
}
tried updateing driver like cp2102 and ch340 but still the same