dirakit community
Published © CC BY

Mengendalikan LED Menggunakan Perintah Suara

Mengendalikan LED menggunakan perintah suara dengan aplikasi Boarduino

BeginnerFull instructions provided10 hours4,242
Mengendalikan LED Menggunakan Perintah Suara

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Resistor
×1
LED (generic)
LED (generic)
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1

Software apps and online services

Boarduino
Arduino IDE
Arduino IDE

Story

Read more

Schematics

20161215hblob4ycdm1g8lfzrlelkq6ndqgstv_png_dzRI0ibdXZ.jpeg

20161215yhlk19xi911ixeiuvpjawaputpamfb_png_r9bTh9p6wq.jpeg

Code

sketch

Arduino
#include SoftwareSerial BT(10, 11); 
String perintah; 
void setup() { 
BT.begin(9600); 
Serial.begin(9600); 
pinMode(2, OUTPUT); 
pinMode(3, OUTPUT); 
pinMode(4, OUTPUT); 
pinMode(5, OUTPUT); 
} 
void loop() { 
while (BT.available()) { 
delay(10); 
char c = BT.read(); 
perintah += c; 
} 
if(perintah.length() > 0) { 
Serial.println(perintah); 
if (perintah == "Hidupkan lampu kamar tidur"){ 
digitalWrite(2, HIGH); 
} else if(perintah == "Matikan lampu kamar tidur"){ 
digitalWrite(2, LOW); 
} else if(perintah == "Hidupkan lampu kamar mandi" | perintah == "hidupkan lampu kamar mandi"){ 
digitalWrite(3, HIGH); 
} else if(perintah == "Matikan lampu kamar mandi" | perintah == "matikan lampu kamar mandi") { 
digitalWrite(3, LOW); 
} else if(perintah == "Hidupkan kipas angin" | perintah == "hidupkan kipas angin") { 
digitalWrite(4, HIGH); 
} else if(perintah == "Matikan kipas angin" | perintah == "matikan kipas angin") { 
digitalWrite(4, LOW); 
} else if(perintah == "Hidupkan komputer" | perintah == "hidupkan komputer") { 
digitalWrite(5, HIGH); 
} else if(perintah == "Matikan komputer" | perintah == "matikan komputer") { 
digitalWrite(5, LOW); 
} else if(perintah == "Hidupkan semua" | perintah == "hidupkan semua") { 
digitalWrite(2, HIGH); 
digitalWrite(3, HIGH); 
digitalWrite(4, HIGH); 
digitalWrite(5, HIGH); 
} else if(perintah == "Matikan semua" | perintah == "matikan semua") { 
digitalWrite(2, LOW); 
digitalWrite(3, LOW); 
digitalWrite(4, LOW); 
digitalWrite(5, LOW); 
} 
perintah=""; 
} 
}

Credits

dirakit community

dirakit community

122 projects • 62 followers
Indonesia IoT Community

Comments

Add projectSign up / Login