2
/* ========================================== ALAT KONTROL TEKS DENGAN PERINTAH SUARA ========================================== */ #include <SoftwareSerial.h> #include <Wire.h> #include <liquidCrystal 12C.h> LiquidCrystal 12C lcd (0*27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIV) ; SoftWareSerial BT (11, 10) ; //TX, RX Bloetooth Communication String Voice ; void setup() { BT.begin (9600) ; lcd.begin (20,4) ; Serial.begin (9600) ; lcd.backlight () ; } void loop() { while (BT.available() ){ //check if there is an available byte to read delay(10) ; //Delay added to make thing stable char c = BT.read () ; //Conduct a serial read if (c == ‘#’) { break ; } //Exit the loop when the # is detected after the word voice += c ; // Shorthand for voice = voice + c

Alat Kontrol Teks Dengan Perintah Suara

Embed Size (px)

DESCRIPTION

ha

Citation preview

Page 1: Alat Kontrol Teks Dengan Perintah Suara

/*

==========================================

ALAT KONTROL TEKS DENGAN PERINTAH SUARA

==========================================

*/

#include <SoftwareSerial.h>

#include <Wire.h>

#include <liquidCrystal 12C.h>

LiquidCrystal 12C lcd (0*27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIV) ;

SoftWareSerial BT (11, 10) ; //TX, RX Bloetooth Communication String Voice ;

void setup() {

BT.begin (9600) ;

lcd.begin (20,4) ;

Serial.begin (9600) ;

lcd.backlight () ;

}

void loop() {

while (BT.available() ){ //check if there is an available byte to read

delay(10) ; //Delay added to make thing stable

char c = BT.read () ; //Conduct a serial read

if (c == ‘#’) {

break ;

} //Exit the loop when the # is detected after the word

voice += c ; // Shorthand for voice = voice + c

}

lcd.print (voice) ; // -------Print a message to the LCD.

delay (5000) ;

Page 2: Alat Kontrol Teks Dengan Perintah Suara

lcd.clear () ;

voice=”” ; //Reset the variable after initiating

}