![](https://cos-cdn.shuashuati.com/pipixue-web/2020-1231-2005-12/ti_inject-812ce.png)
编程使节点1的按键S1每按一次,控制LED1灯闪烁一次。(10分) 闪烁函数定义: /*************************************************************************************************** * @fn HalLedSet * * @brief Tun ON/OFF/TOGGLE given LEDs * * @param leds - HAL_LED_1 ,HAL_LED_2; * mode - BLINK, FLASH, TOGGLE, ON, OFF * @return None ***************************************************************************************************/ uint8 HalLedSet (uint8 leds, uint8 mode) ; 按键中断函数: void SampleApp_HandleKeys( uint8 shift, uint8 keys ) { (void)shift; // Intentionally unreferenced parameter if ( keys & HAL_KEY_SW_6 ) { HalUARTWrite(0,"K1 ",3); // 提示KEY1被按下 (1) ; // LED1 闪一下 } if ( keys & HAL_KEY_SW_1 ) { /* This key sends the Flash Command is sent to Group 1. * This device will not receive the Flash Command from this * device (even if it belongs to group 1). */ SampleApp_SendFlashMessage( SAMPLEAPP_FLASH_DURATION ); } if ( keys & HAL_KEY_SW_2 ) { /* The Flashr Command is sent to Group 1. * This key toggles this device in and out of group 1. * If this device doesn't belong to group 1, this application * will not receive the Flash command sent to group 1. */ aps_Group_t *grp; grp = aps_FindGroup( SAMPLEAPP_ENDPOINT, SAMPLEAPP_FLASH_GROUP ); if ( grp ) { // Remove from the group aps_RemoveGroup( SAMPLEAPP_ENDPOINT, SAMPLEAPP_FLASH_GROUP ); } else { // Add to the flash group aps_AddGroup( SAMPLEAPP_ENDPOINT, &SampleApp_Group ); } } }