ARDUINO5
ARDUINO5
h>
const int servo2Pin = 7; // Pin for the second servo motor (MG996R)
Servo servo1;
Servo servo2;
void setup() {
servo1.attach(servo1Pin);
servo2.attach(servo2Pin);
void loop() {
// Debounce button 1
if (button1Pressed) {
if (digitalRead(button1Pin) == LOW) {
delay(500); // Allow time for servo to move back before next check
// Debounce button 2
if (button2Pressed) {
if (digitalRead(button2Pin) == LOW) {
delay(500); // Allow time for servo to move back before next check