Arduino deneyi 08
Mini Emergency Light
Beginner · 30 min · Timed outputs
Alternate two coloured LEDs to create a compact warning-light pattern.
Malzemeler
- Arduino Uno
- Red and blue LEDs
- 2 × 220 Ω resistors
- Breadboard and jumper wires
Bağlantı
- Connect pins 8 and 9 through separate 220 Ω resistors to the LED anodes.
- Connect both cathodes to GND.
Kod
const int ledA = 8, ledB = 9;
void setup() {
pinMode(ledA, OUTPUT); pinMode(ledB, OUTPUT);
}
void loop() {
digitalWrite(ledA, HIGH); digitalWrite(ledB, LOW); delay(150);
digitalWrite(ledA, LOW); digitalWrite(ledB, HIGH); delay(150);
}
Ne olmalı?
The two LEDs flash alternately.
Meydan okuma
Design a double-flash pattern using a helper function.
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.
