示例#1
0
void blinkLEDs(void)
{
   if (blink_mode == 0)
   {
      led1Toggle();
      led2Toggle();
      led3Toggle();
   }
   else if (blink_mode == 1)
   {
      switch(blink_state)
      {
         case 0:
            blink_state = 1;
            led1On(); led2Off(); led3On();
            break;
         case 1:
            blink_state = 0;
            led1Off(); led2On(); led3Off();
            break;
      }
   }
   else if (blink_mode == 2)
   {
      switch(blink_state)
      {
         case 0:
            blink_state = 1;
            led1Off(); led2Off(); led3Off();
            break;
         case 1:
            blink_state = 2;
            led1On(); led2Off(); led3Off();
            break;
         case 2:
            blink_state = 3;
            led1On(); led2On(); led3Off();
            break;
         case 3:
            blink_state = 0;
            led1On(); led2On(); led3On();
            break;
      }
   }
   
   IFS0bits.T1IF = 0;
}
示例#2
0
文件: Bounce.c 项目: EDAyele/wsn430
void bounceThread2_start(void *arg) {
  message_t msg2;

  for(;;) {
    while (amRadioSend(AM_BROADCAST_ADDR, &msg2, 0, 22) == EBUSY) {}
    led2Off();

    if(amRadioReceive(&msg2, 5000, 22) == SUCCESS) {
      led2On();
    }

    tosthread_sleep(500);
  }
}