Tutorial Mengontrol Lampu dengan Android berbasis Arduino Nano R3


Berikut adalah Tutorial Mengontrol Lampu dengan Android berbasis Arduino Nano R3

Ini adalah sketch program arduino

/*
8_Menyalakan Relay dengan Bluetooth
*/

#define relay 13

char data = 0;

void setup()
{
Serial.begin(9600);
pinMode(relay, OUTPUT);
}

void loop()
{
if (Serial.available() > 0)
{
data = Serial.read();
if (data == '1')
{
digitalWrite(relay, LOW);
Serial.println("Relay Menyala");
}
else if (data == '0')
{
digitalWrite(relay,HIGH);
Serial.println("Relay Mati");
}
}
}


Like it? Share with your friends!

0
3 comments

3 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