top of page

Final Class Proj. week2 ดึงเวลามาใช้

  • Writer: Phurin
    Phurin
  • Apr 12, 2020
  • 1 min read

เมื่อศึกษาตามเอกสารอ้างอิงเราสามารถดึงข้อมูล เช่น


p_tm->tm_sec วินาที

p_tm->tm_min นาที

p_tm->tm_mday วันในเดือนนั้น ๆ


เป็นต้น

ตัวอย่างการทำมาใช้

t=p_tm->tm_hour;
  if(c == 0){
    if(t == 6){
      myservo.write(90);
      delay(1000);
      myservo.write(0);
      c=1;
    }
  }

เมื่อเวลาเท่ากับ 6 โมงเช้าให้หมุน servo เพื่อกดสวิตซ์ไฟหรือนาฟิกาปลุกนั้นเอง




Comments


©2020 by Phurin'S Blog HRI. Proudly created with Wix.com

bottom of page