โครงงานที่ 3


CODE

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);
 }

}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

DIY Arduino Traffic Light Pedestrian Light Push Button Control (https://thecustomizewindows.com/2016/06/diy-arduino-traffic-light-pae-push-button/)

Arduino Bluetooth Control Smart Home (http://androidcontrol.blogspot.com/2015/05/arduino-bluetooth-control-smart-home.html?m=1)

ไมโครคอนเทอร์เลอร์(อ้างอิงhttp://www.techmonkeybusiness.com/ps2-controller-sketch-for-escs-and-stuff.html)