ความรู้แน่น ฟรีสำหรับชุมชน ArduinoAll ที่นี่เท่านั้น

ฟรีและดีที่สุด คอร์สอบรม Arduino + NodeMCU
ทำเพื่อแบ่งปัน ห้ามนำไปจำหน่าย หรือเก็บเงินค่าเรียน
  !!!


  


AllNewStep รับประกันคุณภาพทุกชิ้น วันจันทร์-ศุกร์แจ้งชำระสินค้าก่อน 14.00 จัดส่งทันทีวันนี้ค่ะ

กรุงเทพ /ภาคกลาง ได้พรุ่งนี้


*** สินค้าทุกชิ้น ถ้าสามารถทำรายการสั่งซื้อได้ แสดงว่ามีครบทุกรายการค่ะ *** 

พิมพ์ค้นหาบทความ หัวข้อกระทู้ และสินค้าในเว็บ AllNewStep ได้ที่นี่
QUOTE 

Serial Monitor ไม่แสดงผล

Sutthipon Jairak

ตามหัวข้อเลยค่ะ ไม่ยอมแสดงผลให้ค่ะ

void setup() {

  // put your setup code here, to run once:

 Serial.begin(9600);

}

 

void loop() {

  // put your main code here, to run repeatedly:

  Serial.println ();

  Serial.println ("Hello world");

}

ส่วนอันนี้ Code ค่ะ 

QUOTE 
ความคิดเห็นที่ #1
เจ้าของร้าน

โคดที่ให้มาทำงานได้ถูกต้อง แสดงผลได้ครับ

 

เช็คดังนี้

1. เลือก บอร์ด และ Comport ถุกต้องแล้ว

2. เลือก boardrate ให้ถูกต้อง ในโปรแกรมตั้งเป็น 9600 ใน Serial Monitor ก็ต้องตั้งให้ตรงกันด้วยครับ

QUOTE 
ความคิดเห็นที่ #2
Kanokkorn Malaengphoothong

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

 

//ESP Web Server Library to host a web page

#include <ESP8266WebServer.h>

 

//---------------------------------------------------------------

//Our HTML webpage contents in program memory

const char MAIN_page[] PROGMEM = R"=====(

<!DOCTYPE html>

<html>

<head>

  <title> สั่งเปิดปิดไฟผ่าน WiFi </title>

 

</head>

<body>

<body style = " background : url(http://2.bp.blogspot.com/-2ZYTRs54H0I/Uq6KBsaY75I/AAAAAAAAANE/yV9ASQSSM3E/s1600/Vanda.jpg); background-repeat:no-repeat;background-size:100%  100%; height:800px;background-attachment:fixed"> 

<br><center><b><font face = "Algerian"><font size = 100000><font color = "#FF0000" > Turn on and off the home LED with WiFi </font> </b> </center>

 

 

<i><b><FONT  SIZE = 500><font color = "#AF0DC4" ><marquee scrolldelay="100" direction="Right"><FONT  FACE = "TH KoHo">เปิด - ปิดไฟ LED ในบ้านด้วย WiFi</marquee></FONT></b></i>

 

 

 

 

<br>

<br><center><font face = "MV Boli"><font size = 100><font color = #FFFFFF >CH1 <a href="ledOn1"> <button><font  face = "TH KoHo"><font size = 200><font color = "#21E034" > On </button></a><a href="ledOff1"><font  face = "TH KoHo"><font size = 200><font color = "#FF0000" > OFF </button></a></font></center> 

 

<center><font face = "MV Boli"><font size = 100><font color = #FFFFFF >CH2 <a href="ledOn2"> <button><font  face = "TH KoHo"><font size = 200><font color = "#21E034" > On </button></a><a href="ledOff2"><button><font  face = "TH KoHo"><font size = 200><font color = "#FF0000" > OFF </button></a></font></center>

 

<center><font face = "MV Boli"><font size = 100><font color = #FFFFFF >CH3 <a href="ledOn3"> <button><font  face = "TH KoHo"><font size = 200><font color = "#21E034" > On </button></a><a href="ledOff3"><button><font  face = "TH KoHo"><font size = 200><font color = "#FF0000" > OFF </button></a></font></center>

 

 

<center><img src="http://i245.photobucket.com/albums/gg69/goong_4866/welcome/po2-1.gif" width="350"  height="150" ></center>

 

<marquee scrolldelay="100" direction="left"><img src="https://f.ptcdn.info/604/018/000/1399347104-kapook4240-o.gif" width="110"  height="150" ></marquee>

 

 

 

</body>

</html>

)=====";

//---------------------------------------------------------------

//On board LED Connected to GPIO2

#define LED1 1  

#define LED2 3

#define LED3 15  

 

//SSID and Password of your WiFi router

const char* ssid = " vivo 1606 Kanokkorn ";

const char* password = "21052544";

 

//Declare a global object variable from the ESP8266WebServer class.

ESP8266WebServer server(80); //Server on port 80

 

//===============================================================

// This routine is executed when you open its IP in browser

//===============================================================

void handleRoot() {

 Serial.println("You called root page");

 String s = MAIN_page; //Read HTML contents

 server.send(200, "text/html", s); //Send web page

}

 

void handleLEDon1() { 

 Serial.println("LED on page");

 digitalWrite(LED1,LOW); //LED is connected in reverse

 server.send(200, "text/html", "LED is ON"); //Send ADC value only to client ajax request

}

 

void handleLEDoff1() { 

 Serial.println("LED off page");

 digitalWrite(LED1,HIGH); //LED off

 server.send(200, "text/html", "LED is OFF"); //Send ADC value only to client ajax request

}

void handleLEDon2() { 

 Serial.println("LED on page");

 digitalWrite(LED2,LOW); //LED is connected in reverse

 server.send(200, "text/html", "LED is ON"); 

}

 

void handleLEDoff2() { 

 Serial.println("LED off page");

 digitalWrite(LED2,HIGH); //LED off

 server.send(200, "text/html", "LED is OFF");

}

void handleLEDon3() { 

 Serial.println("LED on page");

 digitalWrite(LED3,LOW); //LED is connected in reverse

 server.send(200, "text/html", "LED is ON"); 

}

 

void handleLEDoff3() { 

 Serial.println("LED off page");

 digitalWrite(LED3,HIGH); //LED off

 server.send(200, "text/html", "LED is OFF");

}

 

//==============================================================

//                  SETUP

//==============================================================

void setup(void){

  Serial.begin(115200);

  

  WiFi.begin(ssid, password);     //Connect to your WiFi router

  Serial.println("");

 

  //Onboard LED port Direction output

  pinMode(LED1,OUTPUT); 

  pinMode(LED2,OUTPUT); 

  pinMode(LED3,OUTPUT); 

 

  //Power on LED state off

 

  digitalWrite(LED3,HIGH);

  digitalWrite(LED2,HIGH);

  digitalWrite(LED1,HIGH);

  

  // Wait for connection

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }

 

  //If connection successful show IP address in serial monitor

  Serial.println("");

  Serial.print("Connected to ");

  Serial.println(ssid);

  Serial.print("IP address: ");

  Serial.println(WiFi.localIP());  //IP address assigned to your ESP

 

  server.on("/", handleRoot);      //Which routine to handle at root location. This is display page

  server.on("/ledOn1", handleLEDon1); 

  server.on("/ledOff1", handleLEDoff1);

  server.on("/ledOn2", handleLEDon2);

  server.on("/ledOff2", handleLEDoff2);

  server.on("/ledOn3", handleLEDon3);

  server.on("/ledOff3", handleLEDoff3);

 

 

  server.begin();                  //Start server

  Serial.println("HTTP server started");

}

//==============================================================

//                     LOOP

//==============================================================

void loop(void){

  server.handleClient();          //Handle client requests

}

แสดงความคิดเห็นที่ 1-2 จากทั้งหมด 2 ความคิดเห็น
ขาย ARDUINO
คุณภาพ อันดับ 1

ได้รับรางวัลร้านยอดเยี่ยม
ตั้งแต่ปี 2558
ขาย Arduino
วีดีโอสอน Arduino

สอน esp8266

สอน Arduino IoT
สอน Arduino แบบเร็ว

สอน NodeMCU

อุปกรณ์ Arduino

MEMBER ZONE

พูดคุย-สอบถาม