You need to enable javaScript to run this app.

SIRINE ARDUINO

SIRINE  ARDUINO

Berikut saya akan simulasikan sirine menggunakan mikrokontroller arduino. perhatikan langkah kerja berikut ini seperti biasa

  1. Gambar kerja/sketsa
  2. Buat Diagram alir
  3. Buat sketsa/koding/program
  4. verifikasi pada aplikasi arduino/compiled
  5. Upload

Kebutuhan :

  1. Buzzer :
  2. NTC Temperatur
  3. Arduino UNO dan LED

SKETSA RANGKAIAN :


KODING :

/**
int INTO = 2;
int INTO = 0;
int LED1 = 3;
int LED2 = 4;
int spk = 5;

*/
void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
}

void loop() {
  if (digitalRead(2) == LOW) {
    tone(5, 900);
    delay(500);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);
    delay(1);
    tone(5, 800);
    delay(500);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    delay(100);

  }
 
  else {
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW);
    delay(100);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);
    delay(100);
  }
}