Skip to content

Instantly share code, notes, and snippets.

View maxpromer's full-sized avatar

Max maxpromer

View GitHub Profile
LINE_Messaging_Massage_Option_t option; // สร้างตัวแปร option
// ตั้งค่าส่งแผนที่
option.map.service = LONGDO_MAP; // ใช้แผนที่จาก Longdo Map
// option.map.service = GOOGLE_MAP; // ใช้แผนที่จาก Google Map
option.map.lat = 13.91024; // ละติจูด
option.map.lng = 100.51108; // ลองจิจูด
option.map.zoom = 20; // ระยะซูม กำหนดได้ 1 - 20
// option.map.api_key = "Google Map API Key"; // กรอก API Key หากใช้ Google Map
#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); }
LINE_Messaging_Massage_Option_t option; // สร้างตัวแปร option
option.image.url = "https://img2.pic.in.th/pic/IMG20230921232431.jpeg"; // ลิ้งรูป ไฟล์ JPEG ขนาดไม่เกิน 2048×2048px
if (LINE.send("User ID/Group ID", "รถโดยขโมย", &option)) { // ส่งข้อความ "รถโดนขโมย" ไปที่ LINE
Serial.println("Send notify successful");
} else {
Serial.printf("Send notify fail. check your token (code: %d)\n", LINE.status_code);
}
#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); }
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
#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); }
if (LINE.send("User ID/Group ID", "รถโดนขโมย")) { // ถ้าส่งข้อความ "รถโดนขโมย" ไปที่ 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
}
LINE.begin(<Channel access token>); // เริ่มต้นใช้ LINE Messaging API กำหนด Channel access token
#include <WiFi.h> // นำเข้าไลบรารี่ WiFi
const char* ssid = "your-ssid"; // ชื่อ WiFi
const char* password = "your-password"; // รหัสผ่าน WiFi
void setup() {
Serial.begin(115200); // เริ่มต้นใช้ Serial ที่ความเร็ว 115200
while(!Serial){delay(100);}
// We start by connecting to a WiFi network
#include <ArtronShop_LineMessaging.h> // นำเข้าไลบารี่ ArtronShop_LineMessaging