Arduino deneyi 07
Moving Flag with a Servo
Beginner · 45 min · Servo control
Move a lightweight paper flag between three angles with an SG90 servo.
Malzemeler
- Arduino Uno
- SG90 micro servo
- Lightweight paper flag
- Jumper wires
- External regulated 5V supply recommended
Bağlantı
- Connect servo signal to pin 9.
- Connect servo power to regulated 5V and ground to GND.
- If using an external supply, connect its GND to Arduino GND.
Kod
#include <Servo.h>
Servo flagServo;
void setup() {
flagServo.attach(9);
}
void loop() {
flagServo.write(0); delay(1000);
flagServo.write(90); delay(1000);
flagServo.write(180); delay(1000);
}
Ne olmalı?
The servo moves the flag between 0°, 90° and 180°.
Meydan okuma
Use a for loop to make the motion smooth.
Güvenlik ve sorun giderme
- Bağlantıyı değiştirmeden önce gücü kes.
- Her LED ile direnç kullan.
- Kart ve port seçimini Arduino IDE'de kontrol et.
- Her kablonun koddaki pin numarasıyla eşleştiğini doğrula.
Not: Ders metinleri İngilizcedir. Orijinal Türkçe çalışma kâğıdı PDF olarak indirilebilir.
