#include <TridentTD_LineNotify.h>
#include <WiFi.h>
#include <HCSR04.h> // ultrasonic library
#define SSID "Wokwi-GUEST" // Replace with your WiFi SSID
#define PASSWORD "" // Replace with your WiFi password
#define LINE_TOKEN "uYuGM3Rljn7NKchgPwMH4LOiBBqNGnNyc0TQYlkM92N" // Replace with your Line Notify token
int sw1 = 5;
int sw2 = 4;
void setup() {
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(SSID, PASSWORD);
Serial.print("Connecting to WiFi...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Set Line Notify token
LINE.setToken(LINE_TOKEN);
// Send a test message
LINE.notify("Hello from ESP32 on Wokwi!");
LINE.notify("======ultrasonic distance======");
pinMode(sw1,INPUT);
pinMode(sw2,INPUT);
}
//void measureAndNotifyDistance() {
// int distance = hc.dist();
// String message = String("");
// message += ">>> ";
// message += distance;
// message += " cm";
// LINE.notify(message);
//}
void loop() {
// int sw1val=digitalRead(sw1);
// int sw2val=digitalRead(sw2);
//if (sw1val==LOW)
//{
LINE.notify("ทดสอบLINE_SW!");
delay(100);
//}
}