Last active
March 3, 2025 18:36
-
-
Save maxpromer/82a91d6469564c741509028c7289ec9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> // นำเข้าไลบรารี่ WiFi | |
#include <ArtronShop_LineMessaging.h> // นำเข้าไลบารี่ ArtronShop_LineMessaging | |
const char* ssid = "WiFi Name"; // ชื่อ WiFi | |
const char* password = "WiFi Password"; // รหัสผ่าน WiFi | |
#define LINE_TOKEN "LINE Token" // Channel access token | |
void setup() { | |
Serial.begin(115200); // เริ่มต้นใช้ Serial ที่ความเร็ว 115200 | |
while (!Serial) { delay(100); } | |
// We start by connecting to a WiFi network | |
Serial.println(); | |
Serial.println("******************************************************"); | |
Serial.print("Connecting to "); | |
Serial.println(ssid); | |
WiFi.begin(ssid, password); // เริ่มต้นเชื่อมต่อ WiFi | |
while (WiFi.status() != WL_CONNECTED) { // วนลูปหากยังเชื่อมต่อ WiFi ไม่สำเร็จ | |
delay(500); | |
Serial.print("."); | |
} | |
Serial.println(""); | |
Serial.println("WiFi connected"); | |
Serial.println("IP address: "); | |
Serial.println(WiFi.localIP()); | |
LINE.begin(LINE_TOKEN); // เริ่มต้นใช้ LINE Notify | |
LINE_Messaging_Massage_Option_t option; // สร้างตัวแปร option | |
// ดูรายการสติ๊กเกอร์ที่รองรับได้ที่ https://developers.line.biz/en/docs/messaging-api/sticker-list/ | |
option.sticker.package_id = 446; // สติ๊กเกอร์ Package ID | |
option.sticker.id = 1988; // สติ๊กเกอร์ ID | |
if (LINE.send("User ID/Group ID", "รถโดยขโมย", &option)) { // ถ้าส่งข้อความ "รถโดนขโมย" ไปที่ LINE สำเร็จ | |
Serial.println("Send notify successful"); // ส่งข้อความ "Send notify successful" ไปที่ Serial Monitor | |
} else { // ถ้าส่งไม่สำเร็จ | |
Serial.printf("Send notify fail. check your token (code: %d)\n", LINE.status_code); // ส่งข้อความ "Send notify fail" ไปที่ Serial Monitor | |
} | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment