Notes
![]() ![]() Notes - notes.io |
#include <ESP8266WiFi.h>
#define WIFI_SSID "Mew_2.4G"
#define WIFI_PASSWORD "0654414954"
#define LINE_TOKEN_PIR "l5o5P5q7X1CGZpAzpLxpSpwYwlwjCKoyR6dRoa1QUsc"
String message1 = "hello";
int LED1 = 2; //pinLED
int ir1Pin = 16 ; //pin ir1Pin
int ir2Pin = 14; //pin ir2Pin
//-------------------------------------------------------------------------------------------------------------------
void setup() {
Serial.begin(115200);
Serial.println();
pinMode(ir1Pin, INPUT);
pinMode(ir2Pin, INPUT);
pinMode(LED1, OUTPUT);
Serial.println("connecting");
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
}
//-------------------------------------------------------------------------------------------------------------------
void loop() {
if (WiFi.status() == WL_CONNECTED) {
digitalWrite(LED_BUILTIN, LOW);
} else {
digitalWrite(LED_BUILTIN, HIGH);
}
if ((digitalRead(ir1Pin) == HIGH) && (WiFi.status() == WL_CONNECTED)) {
Serial.println("Detect !");
Line_Notify1(message1);
delay(100);
}
if ((digitalRead(ir2Pin) == HIGH)) {
digitalWrite(LED1, HIGH);
}
else if ((digitalRead(ir2Pin) == LOW)) {
digitalWrite(LED1, LOW);
}
}
//-------------------------------------------------------------------------------------------------------------------
void Line_Notify1(String message) {
WiFiClientSecure client;
if (!client.connect("notify-api.line.me", 443)) {
Serial.println("connection failed");
delay(2000);
return;
}
String req = "";
req += "POST /api/notify HTTP/1.1rn";
req += "Host: notify-api.line.mern";
req += "Authorization: Bearer " + String(LINE_TOKEN_PIR) + "rn";
req += "Cache-Control: no-cachern";
req += "User-Agent: ESP8266rn";
req += "Content-Type: application/x-www-form-urlencodedrn";
req += "Content-Length: " + String(String("message=" + message1).length()) + "rn";
req += "rn";
req += "message=" + message1;
// Serial.println(req);
client.print(req);
delay(20);
while (client.connected()) {
String line = client.readStringUntil('n');
if (line == "r") {
break;
}
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team