Tutorial Menyalakan Buzzer dengan Sensor PIR berbasis Arduino Nano R3


Berikut adalah Tutorial Menyalakan Buzzer dengan Sensor PIR berbasis Arduino Nano R3

Ini adalah sketch program arduino

/*
3_PIR –> Buzzer
*/

#define sensor    A0
#define buzzer    13

boolean kondisi = 0;

void setup()
{
Serial.begin(9600);
pinMode(sensor, INPUT);
pinMode(buzzer, OUTPUT);
}

void loop()
{
if(digitalRead(sensor) == 1)
{
kondisi = 1;
}
else
{
kondisi = 0;
}

digitalWrite(buzzer, kondisi);
delay(100);
}


Like it? Share with your friends!

0

0 Comments

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

Choose A Format
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format