Arduino: 1.8.9 (Windows 8.1), Board: "Arduino Nano, ATmega328P"
Sketch uses 2160 bytes (7%) of program storage space. Maximum is 30720 bytes.
Global variables use 52 bytes (2%) of dynamic memory, leaving 1996 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1a
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
ถ้าซื้อกับที่ร้าน ArduinoAll บอร์ด Arduino nano ทางร้านตรวจสอบให้ละเอียดก่อนส่งแล้วจะต้องใช้ได้
เช็คว่าเลือกบอร์ด / และ comport ถูกต้องแล้ว และ Processor เลือก 1 ใน 2 ตัวตามที่วงไว้ครับ
รบกวนขอความช่วยเหลืออีกหนึ่งโครงงานครับ
ผมทำตู้จดหมายแจ้งเตือนทาง ไลน์ แต่ไม่สำเร็จ
รบกวนด้วยนะครับ แก้ไขตรงไหนครับ ใช้ Nodemcu esp2866 กับ โมดูลตรวจจับวัตถุ อินฟาเรด
code จาก อุดมไอเดีย ครับ
void Line_Notify1(String message1) ;
#include <TridentTD_LineNotify.h>
#include <ESP8266WiFi.h>
#include <DHT.h>
#define WIFI_SSID "SP.SHOP" /////////////*************แก้
#define WIFI_PASSWORD "0896768446"////////**************แก้
#define LINE_TOKEN_PIR "spc1Hyf5c7Ywqv3Wnie2RlVmUDVLA1Q3BdgjwrQlw5H"////***************แก้
#define PirPin D6
#define DHTPIN D7
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
String message1 = "ms";//****************แก้
bool beep_state = false;
bool send_state = false;
uint32_t ts, ts1, ts2;
void setup() {
Serial.begin(115200);
Serial.println();
pinMode(PirPin, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
dht.begin();
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());
delay(10000);
Serial.println("Pir Ready!!");
read_sensor();
ts = ts1 = ts2 = millis();
}
void loop() {
ts = millis();
if (WiFi.status() == WL_CONNECTED) {
digitalWrite(LED_BUILTIN, LOW);
} else {
digitalWrite(LED_BUILTIN, HIGH);
}
if ((ts - ts2 >= 60000) && (WiFi.status() == WL_CONNECTED)) {
read_sensor();
}
if ((ts - ts1 >= 5000) && (beep_state == true)) {
beep_state = false;
}
if ((digitalRead(PirPin) == HIGH) && (beep_state == false) && (WiFi.status() == WL_CONNECTED)) {
while (digitalRead(PirPin) == HIGH) delay(100);
Serial.println("Detect !");
Line_Notify1(message1);
beep_state = true;
}
delay(10);
}
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.1\r\n";
req += "Host: notify-api.line.me\r\n";
req += "Authorization: Bearer " + String(LINE_TOKEN_PIR) + "\r\n";
req += "Cache-Control: no-cache\r\n";
req += "User-Agent: ESP8266\r\n";
req += "Content-Type: application/x-www-form-urlencoded\r\n";
req += "Content-Length: " + String(String("message=" + message1).length()) + "\r\n";
req += "\r\n";
req += "message=" + message1;
// Serial.println(req);
client.print(req);
delay(20);
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
}
}
void read_sensor() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
}
มีโคดตัวอย่างการส่งข้อมูลทาง line ดังนี้
https://www.arduinoall.com/b/289
หรือเรียน ESP8266 แบบละเอียดในคอร์สเรียน Arduino ESP8266 IoT ที่หน้าเว็บด้านบนซ้ายครับ