//Program Serial Bluetooth
//By Anggi XI TEI 1
int led1 = 8;
int led2 = 3;
int kondisi = 0;
char data;
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
Serial.begin(9600);
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
Serial.println();
}
void loop() {
if(Serial.available()>0){
data = Serial.read();
}
if(data == 'a'){
digitalWrite(led1,HIGH);
kondisi = 0;
}
if(data == 'm'){
digitalWrite(led1,LOW);
kondisi = 0;
}
}
// huruf 'a' led 1 nyala
// huruf 'm' led 1 padam
// huruf 'b' led 2 nyala
// huruf 'n' led 2 padam
// huruf 'c' 2 led nyala begantian (flip-flop)
// huruf 'd' semua led padam