App Inventor
App Inventor adalah sebuah aplikasi web open-source yang awalnya disediakan oleh Google, dan sekarang dikelola oleh Massachusetts Institute of Technology (MIT).
Anda yang tidak memiliki keahlian
programming pun dapat menggunakan AppInventor. Didesain dengan sistem visual -
konstruksionis dan dapat dioperasikan hanya menggunakan peramban (browser).
Pastikan semua Rangkaian disusun
seperti gambar
Code
Arduino
#include<SoftwareSerial.h>// impor library softwareserialSoftwareSerial
BlueSer(10, 11); // RX, TXint led1=2;
int led2=3;int led3=4;
int led4=5; char separadorDatos = '#';int BluetoothData;
void setup() {
BlueSer.begin(115200); BlueSer.println("Bluetooth ready, tekan button utk on/off LED");pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);Serial.begin(9600);
}void loop() { sensorValue = analogRead(A0);
if (BlueSer.available()>0){
BluetoothData=BlueSer.read();Serial.println(BluetoothData-48);
//BlueSer.print("#");//BlueSer.println(sensorValue);
//Serial.print("#");//Serial.println(sensorValue);
if(BluetoothData=='4'){digitalWrite(led1,HIGH);
BlueSer.println("LED1 on");Serial.println("LED1 on");
}if (BluetoothData=='0'){
digitalWrite(led1,LOW);BlueSer.println("LED1 off");
Serial.println("LED1 off");}
if(BluetoothData=='5'){
digitalWrite(led2,HIGH);BlueSer.println("LED2 on");
Serial.println("LED2 on");}
if (BluetoothData=='1'){digitalWrite(led2,LOW);
BlueSer.println("LED2 off");Serial.println("LED2 off");
}
if(BluetoothData=='6'){
digitalWrite(led3,HIGH);BlueSer.println("LED3 on");
Serial.println("LED3 on");}
if (BluetoothData=='2'){
digitalWrite(led3,LOW);BlueSer.println("LED3 off");
Serial.println("LED3 off");}
if(BluetoothData=='7'){digitalWrite(led4,HIGH);
BlueSer.println("LED4 on");Serial.println("LED4 on");
}if (BluetoothData=='3'){digitalWrite(led4,LOW);
BlueSer.println("LED4 off");
Serial.println("LED4 off");}
delay(100);}
}
Aplikasi Android
bagi ingin belajar kode appinventor
dan remixing silahkan download di gallery http://ai2.appinventor.mit.edu
Tulis komentar dibawah jika terjadi masalah
Oke terimakasih Semoga membantu
(^_*) hehe
MANTAP MAS
ReplyDeleteTidak pakai relay yah bos
ReplyDeleteLCD computer monitors have many advantages over CRTs and because of their advantages they managed to suppress CRTs from the market.Best 4k monitor 144hz 2019
ReplyDeleteapk buat connect dari android pake aapa mas
ReplyDelete