simak videonya :
Di sini
Untuk belajar elektronik dasar :
Di sini
Ini adalah scetch untuk lampu remot arduino:
/* sketch ini menggunakan relay aktif "LOW"
* bila
teman" menggunakan relay aktif "HIGH"
* ganti "HIGH"
yang ada di scetch dengan "LOW"
* dan yang "LOW" ganti
dengan "HIGH"
*/
#include <SoftwareSerial.h>
SoftwareSerial module_bluetooth(0, 1);
char data;
void
setup() {
Serial.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
}
void
loop() {
if( Serial.available()>0 )
data = Serial.read();
Serial.println(data);
Serial.print("\n");
if( data == '1' ) {
digitalWrite(2,LOW); } //lampu 1 on
else if( data == 'A' ) {
digitalWrite(2,HIGH);} //lampu 1 off
else if( data == '2' ){
digitalWrite(3,LOW);
} //lampu 2 on
else if( data == 'B' ) {
digitalWrite(3,HIGH);} //lampu 2 off
else if( data == '3' ) {
digitalWrite(4,LOW); } //lampu 3 on
else if( data == 'C' ) {
digitalWrite(4,HIGH);} //lampu 3 off
else if( data == '4' ){
digitalWrite(5,LOW);
} //lampu 4 on
else if( data == 'D' ) {
digitalWrite(5,HIGH);} //lampu 4 off
if( data == '5' ) {
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);} //lampu all on
if(
data == 'E' ) {
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);} //lampu all off
}
This comment has been removed by a blog administrator.
ReplyDelete