-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoogleHome.cpp
More file actions
29 lines (26 loc) · 787 Bytes
/
Copy pathGoogleHome.cpp
File metadata and controls
29 lines (26 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "GoogleHome.h"
/** The code herein written by the Author is released under the terms of the unlicense. https://unlicense.org/
* @author https://github.com/lexfp
*/
void GoogleHome::init(char googleHomeName[]) {
Serial.println("connecting to Google Home...");
if (ghn.device(googleHomeName, "en") != true) {
Serial.println(ghn.getLastError());
return;
}
Serial.print("Located Google Home(");
Serial.print(ghn.getIPAddress());
Serial.print(":");
Serial.print(ghn.getPort());
Serial.println(")");
}
void GoogleHome::notifyTTS(const char text[]) {
if (ghn.notify(text) != true) {
Serial.println(ghn.getLastError());
}
}
void GoogleHome::notifyMP3(const char url[]) {
if (ghn.play(url) != true) {
Serial.println(ghn.getLastError());
}
}