Ngomongin Buzzer Yuk! Aktif vs Pasif #Arduino #buzzer

Details
Title | Ngomongin Buzzer Yuk! Aktif vs Pasif #Arduino #buzzer |
Author | Wahyu Dharsito |
Duration | 6:05 |
File Format | MP3 / MP4 |
Original URL | https://youtube.com/watch?v=uV45sn4AIOE |
Description
Ngomongin Buzzer Yuk! Aktif vs Pasif #Arduino #buzzerbeater
Link afiliasi:
Arduino Uno CH340 : https://s.shopee.co.id/6fW89mMxG4
Arduino Uno 16U2: https://s.shopee.co.id/6ppYM5MJv7
Layar LCD 1602: https://s.shopee.co.id/708yYOLgaA
=========================================
#include "Wire.h"
#include "LCD_I2C.h"
LCD_I2C lcd(0x27, 16, 2); // Change 0x27 if your LCD I2C address is different
#define BUZZER_ACTIVE 5
#define BUZZER_PASSIVE 6
void setup() {
pinMode(BUZZER_ACTIVE, OUTPUT);
pinMode(BUZZER_PASSIVE, OUTPUT);
lcd.begin();
lcd.backlight();
lcd.clear();
}
void loop() {
// --- Active buzzer ---
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("BUZZER ACTIVE");
digitalWrite(BUZZER_ACTIVE, HIGH); // Turn on active buzzer
delay(1000);
digitalWrite(BUZZER_ACTIVE, LOW); // Turn it off
delay(500); // Small gap between sequences
// --- Passive buzzer ---
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("BUZZER PASSIVE");
tone(BUZZER_PASSIVE, 262); // C4
delay(500);
tone(BUZZER_PASSIVE, 294); // D4
delay(500);
tone(BUZZER_PASSIVE, 330); // E4
delay(500);
noTone(BUZZER_PASSIVE); // Stop tone
delay(1000); // Wait before looping again
}