วันศุกร์ที่ 8 กุมภาพันธ์ พ.ศ. 2562

โครงงานที่ 3

                             

void beep(void);

main()

{

 int timel,time2;

 TRISB = 0xF0;
  while(1)

 {

  PORTB.F1=0;

  PORTB.F2=0;

  PORTB.F3=0;

 while (~PORTB.F4&PORTB.F5&PORTB.F6)

  {

   PORTB.F1=1;

   PORTB.F2=0;

   PORTB.F3=0;

   for(timel=0;timel<20000;timel++)

   {

   while(PORTB.F4&~PORTB.F5&PORTB.F6)

   {

    PORTB.F1=1;

    PORTB.F2=1;

    PORTB.F3=0;

    for(time2=0;time2<10000;time2++)

    {

    while(PORTB.F4&PORTB.F5&~PORTB.F6)

        {

         PORTB.F1=1;

         PORTB.F2=1;

         PORTB.F3=1;

         beep();

         Delay_ms(1000);

         }

         }

       }

       }

      }

     }

   }

void beep(void)

{

 int i ;
 for(i=0;i<200;i++)

 {

  PORTB.F0=1;

  Delay_us(200);

  PORTB.F0=0;

  Delay_us(200);

 }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Internet of Things (IoT)

Internet of Things หรือ IoT  Internet of Things (IoT)  คือ การที่อุปกรณ์อิเล็กทรอนิกส์ต่างๆ สามารถเชื่อมโยงหรือส่งข้อมูลถึงกันได้ด้วยอิ...