2018年5月1日 星期二
Control LEDs with Voice Command : good morning / good night
/*
HC-05 VCC → Arduino 5V
HC-05 GND → Arduino GND
HC-05 RXD → Arduino TXD pin1
HC-05 TXD → Arduino RXD pin 0
HC-05 KEY → Not Connected
upload 時需先拔除 RXD / TXD 接線
*/
String voice;
#define led 13
void setup() {
// put your setup code here, to run once:
Serial.begin(38400);
//Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop() { // put your main code here, to run repeatedly:
while (Serial.available()){ //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c = Serial.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
}
if (voice.length() > 0) {
Serial.println(voice);
//-----------------------------------------------------------------------//
//----------Control Multiple Pins/ LEDs----------//
if(voice == "good morning")
{
digitalWrite(led,HIGH);
}
else if(voice == "good night")
{
digitalWrite(led,LOW);
}
voice=""; //Reset the variable after initiating
}
}
訂閱:
張貼留言 (Atom)
MIFARE Classic Command Flow Diagram
MIFARE Classic Command Flow Diagram 這個程式將圖片中的 MIFARE Classic Command Flow Diagram 完整繪製在畫布上(包含中英文對照、虛線錯誤返回路徑、實線流程箭頭以及右側的「典型交易時間」資訊),並提供「上一...
-
Line 發報機 Python TKinter (CONFIG_LINE Message API_2.py) import serial import serial.tools.list_ports import tkinter as tk from tkinter import...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
-
ESP32 DHT22 + Telegram Telegram Bot 指令列表 /start - 開始對話 /help - 指令說明 /status - 查詢目前溫濕度 /mute - 暫停變化通知 /resume - 恢復變化通知 /stopreport - 停止定時回報 /...












Your website offered us with valuable information to work on. 먹튀검증사이트
回覆刪除