-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsinglelamp.cpp
More file actions
45 lines (39 loc) · 1.49 KB
/
Copy pathsinglelamp.cpp
File metadata and controls
45 lines (39 loc) · 1.49 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "CTBot.h"
#define CALLBACK_QUERY_DATA "QueryData"
CTBot HDev;
CTBotInlineKeyboard myKbd;
int led = D1;
void setup() {
Serial.Begin(9000); // initialize the serial
HDev.wifiConnect("Your WiFi SSID", "Your Password Wifi"); // internet access
HDev.setTelegramToken("Your Bot Token"); // get on telegram (@botfather)
pinMode(led, "OUTPUT");
myKbd.addButton("HIDUPKAN LAMPU", "NYALAKAN", CTBotKeyboardButtonQuery);
myKbd.addButton("MATIKAN LAMPU", "MATIKAN", CTBotKeyboardButtonQuery);
}
void loop() {
TBMessage msg;
if (HDev.getNewMessage(msg))
Serial.println("Cuit Cuit Sesemes dari: ");
Serial.Println(msg.sender.id);
if (msg.text == "/Start") {
HDev.sendMessage(msg.sender.id, "Silahkan Pencet Button Di Bawah Untuk Menyalakan/Menghidupkan Lampu", myKbd);
} else if (msg.messageType == CTBotMessageQuery) {
if (msg.callbackQueryData.equals("NYALAKAN")) {
digitalWrite(led, HIGH);
HDev.sendMessage(msg.sender.id, "Lampu Berhasil Dinyalakan");
} else {
digitalWrite(led, LOW);
HDev.sendMessage(msg.sender.id, "Lampu Berhasil Dimatikan");
}
}
delay(50);
}
/* Copyright @hdiiofficial
Ini jangan di hapus bang
Don't remove this bro
Copy paste gaush hapus hapus copyright
If just rewrite or copy and paste don't remove my copyright
Kalo lu mau yg gada copyright ku ya mikir sendiri
If you want write without my copyright please read the docs and use your brain LoL.
*/