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

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


  


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

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


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

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

โค๊ต rbbb_server จะทำเป็น หยุดเวลาไหมครับ

Pannatat

คือเมื่อ อัพโหลด ลงบรอดแล้ว เวลาก็จะนับไปเรื่อยๆ แต่ผมอยากทำให้มัน กดปุ่ม 1ครั้ง เวลาหยุด แล้วกดอีกครั้ง

เวลาเดิน ต่อ หรือ กด แล้ว เวลา กลับไปเริ่มต้นใหม่และหยุด ประมาณนี้นะครับ

 

 

// This is a demo of the RBBB running as webserver with the Ether Card
// 2010-05-28 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,1,203 };

byte Ethernet::buffer[500];
BufferFiller bfill;

void setup () {
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println(F("Failed to access Ethernet controller"));
  ether.staticSetup(myip);
}

static word homePage() {
  long t = millis() / 1000;
  word h = t / 3600;
  byte m = (t / 60) % 60;
  byte s = t % 60;
  bfill = ether.tcpOffset();
  bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "<meta http-equiv='refresh' content='1'/>"
    "<title>RBBB server</title>"
    "<h1>$D$D:$D$D:$D$D</h1>"),
      h/10, h%10, m/10, m%10, s/10, s%10);
  return bfill.position();
}

void loop () {
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
 
  if (pos)  // check if valid tcp data is received
    ether.httpServerReply(homePage()); // send web page data
}

QUOTE 
ความคิดเห็นที่ #1
Pannatat

จากรูป คือผมเอา rbbb_sever ไปใส่ไว้กับ ตัว เว็บเปิด/ปิด Relay คือผมจะทำคือ Relay ทำงาน แล้ว rbbb_sever เรื่มนับเวลา พอ เป็น off rbbb_sever หยุดเวลา

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

ทำได้ ไม่ต้องดึงจากเวลาจริง เก็บตัวแปรเวลาไว้ในโปรแกรมแล้วอัพเดทกับตัวแปรในโปรแกรมเรา ลองเขียนโปรแกรมจับเวลาแยกมาเล่น ๆ ดูครับ

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

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

สอน esp8266

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

สอน NodeMCU

อุปกรณ์ Arduino

MEMBER ZONE

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