# การใช้งาน LINE Notify

**สำหรับบทความนี้ เราจะลองมาใช้ LINE notify จาก CorgiDude ด้วย** library Corgi85 กันนะครับ

ก่อนอื่นเพื่อนๆ จะต้องทำการอัพเกรดเฟิร์มแวร์ CorgiDude และโปรแกรม library Corgi85 ลงใน ESP 8285 ก่อน โดยสามารถดูรายละเอียดได้จาก <https://www.aiiotshop.com/b/22> จากนั้นเพื่อนๆก็ต้องสร้างตัว LINE bot ซึ่งจะเชื่อมต่อกับ LINE ID ของเรา โดยจะทำให้เราสามารถแจ้งเตือนในกลุ่มที่เราแอด bot เข้าไปด้วยได้ สามารถดูรายละเอียดเพิ่มได้ที่ <https://www.aiiotshop.com/article/21/> <https://notify-bot.line.me/en/> (เมื่อทำการสร้างตัว LINE bot เรียบร้อยแล้ว เราจะต้องใช้ตัวรหัส token ในการใช้งาน) โดยวิธีการดังนี้\*\*

เปิดเว็ป <https://notify-bot.line.me/en/> ทำการสแกน QR Code เพิ่ม "LINE Notify" เป็นเพื่อน

![](https://ff.lnwfile.com/_/ff/_raw/k0/ql/x0.png)

**กด "เข้าสู่ระบบ" ใส่ E-mail และ password ของ LINE ที่เราลงทะเบียนไว้จากนั้นกด "LOGIN"**

![](https://ff.lnwfile.com/_/ff/_raw/gf/1s/jn.png)

**จากนั้นเปิด tap เลือก "My page"**

![](https://ff.lnwfile.com/_/ff/_raw/1x/k0/f5.png)

**กด "Generate token"**

![](https://ff.lnwfile.com/_/ff/_raw/6q/7u/ha.png)

**ตั้งชื่อให้ LINE bot และกลุ่มแชทที่ต้องการให้แจ้งเตือน โดยผมจะเลือกเป็น 1-no-1 เพื่อทำการทดสอบ** **\*\*กด "Generate token"\*\***

![](https://ff.lnwfile.com/_/ff/_raw/vn/dd/bp.png)

**เราจะได้รหัส token ที่ใช้ในการแจ้งเตือนให้กด Copy ไว้ เป็นการเสร็จเรียบร้อย**

![](https://ff.lnwfile.com/_/ff/_raw/ua/em/r6.png)

**เมื่อเราได้รหัส** **\*\*token มาแล้วก็สามารถเอามาใช้ใน code micropython ที่ใช้ใน\*\*** **\*\*CorgiDude ได้เลย\*\* โดย ตัวอย่าง code เป็นแบบนี้ครับ (**[**รายละเอียดเพิ่มเติม LINK**](https://www.aiiotshop.com/b/2)**)**

```
import sensor, image, time, lcd
from Corgi85 import corgi85


token = "sqdSuyH9oidoRBZG5T72UdpYiMFcgeUEifAYTmSfdo8"

#reset esp8285
corgi85.reset()
#print(dir(corgi85))

#setup camera
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)

#sensor.set_windowing((224, 224))
#sensor.set_vflip(1)
#sensor.set_hmirror(0)
sensor.run(1)

#setup LCD screen
lcd.init()
lcd.rotation(0)

time.sleep(1)

count = 0
while(corgi85.wifi_check() == 0):
    print("WIFI Connecting")
    time.sleep(1)

print("\n\nWIFI Connected")

print("\n\nSet line Token:",token)
corgi85.LINE_setToken(token)  #set line Token

print("\n\nsend line image")
img = sensor.snapshot() # camera capture image
lcd.display(img)        # lcd  display image
corgi85.LINE_notifyPicture(img, "CorgiDude LINE notify Picture")   # send image to line noti
time.sleep(3)

print("\n\nsend message to line noti: Hello From CorgiDude")
corgi85.LINE_notify("Hello From CorgiDude")
time.sleep(3)

print("\n\nsend line sticker")
corgi85.LINE_notifySticker(1, 1)   # detail : https://devdocs.line.me/files/sticker_list.pdf
time.sleep(3)

print("\n\nsend line sticker & message")
corgi85.LINE_notifySticker_text("Hello From CorgiDude", 1, 1) #detail :  https://devdocs.line.me/files/sticker_list.pdf

##print("\n\n",dir(corgi85))



## https://github.com/AiDude-io/CorgiDude/tree/master/08%20-%20Face%20Detection << download kmodel
#import sensor
#import image
#import lcd
#import KPU as kpu
#from Corgi85 import corgi85


#while(corgi85.wifi_check() == 0):
    #print("WIFI Connecting")
    #time.sleep(1)

#token = "sqdSuyH9oidoRBZG5T72UdpYiMFcgeUEifAYTmSfdo8"
#corgi85.LINE_setToken(token)  #set line Token


#lcd.init()
#lcd.rotation(0)

#sensor.reset()
#sensor.set_pixformat(sensor.RGB565)
#sensor.set_framesize(sensor.QVGA)
#sensor.run(1)

#task = kpu.load(0x300000)

#anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437, 6.92275, 6.718375, 9.01025)
#a = kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)

#while(True):
    #img = sensor.snapshot()

    #faces = kpu.run_yolo2(task, img)

    #if faces:
        #for face in faces:
            #img.draw_rectangle(face.rect(),color=(0,255,0),thickness=2)
    #img = img.resize(240,240)
    #lcd.display(img)

    #if faces:
        #img2 = sensor.snapshot()
        #corgi85.LINE_notifyPicture(img2, "Detected some people")

#kpu.deinit(task)
```

**เท่านี้เพื่อนๆก็สามารถแจ้งเตือนผ่าน LINE ด้วย CorgiDude ได้แล้วครับ**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://corgidude.makerasia.com/article-and-api/line-notify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
