Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <TridentTD_LineNotify.h> // ดาวน์โหลด Library ได้ที่ https://github.com/TridentTD/TridentTD_LineNotify
- #define SSID "xxx" // ชื่อ Wi- Fi ที่ต้องการให้ ESP8266 เชื่อมต่อ
- #define PASSWORD "xxx" // รหัส Wi-Fi
- #define LINE_TOKEN "xxx" //Token line ที่ขอมาจาก Line notify
- #define trigPin1 D3
- #define echoPin1 D4
- int ledPin = 2;
- int ledPin3 = 3;
- int analogPin = 5; //I wonder if there is leg 69
- int val = 0;
- void setup() {
- pinMode(ledPin, OUTPUT); // sets the pin as output
- pinMode(ledPin3, OUTPUT); // sets the pin as output
- Serial.begin(115200);
- WiFi.begin(SSID, PASSWORD); // เชื่อมต่อ Wi-Fi
- while (WiFi.status() != WL_CONNECTED) {
- delay(1000);//Avoid spamming lol
- Serial.print(".");
- }
- pinMode(trigPin1, OUTPUT);//Here also
- pinMode(echoPin1, INPUT);//COuld be deleted
- Serial.println(""); // เชื่อมต่อเสร็จหลุดออกจากลูป มาทำบรรทัดนี้ลงไป
- Serial.println("WiFi connected");
- LINE.setToken(LINE_TOKEN); // เชื่อมต่อกับ Token Line
- Serial.begin(9600);//WTH, this can be removed idk
- }
- void loop() {
- int sensorValue = analogRead(A5);
- val = analogRead(analogPin); //อ่านค่าสัญญาณ analog ขา5 ที่ต่อกับ LDR Photoresistor Sensor Module
- Serial.print("val = "); // พิมพ์ข้อความส่งเข้าคอมพิวเตอร์ "val = "
- Serial.println(val); // พิมพ์ค่าของตัวแปร val
- if (val < 500) {
- LINE.notify("ITS DARK HERE JOHN,JOHN JOHN! AHHHH"); //Dark idk
- }
- else {
- LINE.notify("ITS SO BRIGHT HERE JOHN, AHHHH"); //Light idk
- }
- delay(100);
- }
Advertisement