here is my schematic
and here is my circut
want to test my code
#include <Servo.h> // Include Servo library if using servo motors
Servo motor1; // Create servo object for motor 1
Servo motor2; // Create servo object for motor 2
const int motor1Pin = 9; // Define pin connected to motor 1
const int motor2Pin = 10; // Define pin connected to motor 2
int motor1Angle = 6; // Define angle for motor 1 movement
int motor2Angle = 15; // Define angle for motor 2 movement
unsigned long previousMillis1 = 0; // Variable for motor 1 timing
unsigned long previousMillis2 = 0; // Variable for motor 2 timing
void setup() {
motor1.attach(motor1Pin); // Attach motor 1 to chosen pin
motor2.attach(motor2Pin); // Attach motor 2 to chosen pin
}
void loop() {
unsigned long currentMillis = millis();
// Move motor 1 every minute
if (currentMillis - previousMillis1 >= 60000) {
motor1.write(motor1Angle);
delay(1000); // Adjust delay as needed for smooth movement
motor1.write(90); // Set motor 1 back to initial position
previousMillis1 = currentMillis;
}
// Move motor 2 every hour
if (currentMillis - previousMillis2 >= 3600000) {
motor2.write(motor2Angle);
delay(1000); // Adjust delay as needed for smooth movement
motor2.write(90); // Set motor 2 back to initial position
previousMillis2 = currentMillis;
}
}
is it right or trash