Skip to content

Instantly share code, notes, and snippets.

@lazypwny751
Created December 3, 2025 21:30
Show Gist options
  • Select an option

  • Save lazypwny751/97e2d082143c49469c8a73f1400c85e8 to your computer and use it in GitHub Desktop.

Select an option

Save lazypwny751/97e2d082143c49469c8a73f1400c85e8 to your computer and use it in GitHub Desktop.
Melodi Çalan Servo Motor
#include <Servo.h>
Servo myServo;
// Basit melodi notaları (servo pozisyon değişimi ile)
int melody[] = {30, 60, 90, 120}; // Servo açıları
int noteDuration = 200; // Her nota 200 ms
void setup() {
myServo.attach(9); // Servo pinini bağla
}
void loop() {
// Melodiyi sırayla çal
for (int i = 0; i < 4; i++) {
myServo.write(melody[i]); // Servo açı değişimi
delay(noteDuration); // Notanın süresi
}
delay(500); // Melodiyi tekrar etmeden önce kısa bekleme
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment