int main(void) { uint32_t setHour=0,setMinute=0; //uint32_t v; Init(); while (1) { LED1( ON ); // 亮 Delay(500000); LED1( OFF ); // 灭 Delay(500000); if(receive[19]==1) { Accept_to_complete(&setHour,&setMinute); memset(receive,0,sizeof(receive)); } IWDG_ReloadCounter(); tmpchange(); vTemp = tmp(); printf("the temp =%d",vTemp/1000); isTimeOut(setHour,setMinute); } }
static void process_recv_html(char * body) { char * find = strstr(body,"}"); if (find == NULL) { printf("ERROR\n"); return ; } find = find -1 ; if (find[0] == '1' ) { LED1(0); LED2(0); LED3(0); printf("ON\n"); } if (find[0] == '0' ) { LED1(1); LED2(1); LED3(1); //PB8 为继电器控制管脚 printf("OFF\n"); } // }
/* * 函数名:CAN_Test * 描述 :CAN 回环模式跟中断模式测试 * 输入 :无 * 输出 : 无 * 调用 :外部调用 */ void USER_CAN_Test(void) { /* CAN transmit at 100Kb/s and receive by polling in loopback mode */ TestRx = CAN_Polling(); if (TestRx == FAILED) { LED1( OFF ); // LED1 OFF } else { LED1( ON ); // LED1 ON; } /* CAN transmit at 500Kb/s and receive by interrupt in loopback mode */ TestRx = CAN_Interrupt(); if (TestRx == FAILED) { LED2( OFF ); // LED2 OFF; } else { LED2( ON ); // LED2 ON; } }
/** * @brief ������ * @param �� * @retval �� */ int main(void) { /* ���� led */ LED_GPIO_Config(); /* ����exti�ж� */ EXTI_Key_Config(); /* ���ô���Ϊ�ж�ģʽ */ USART1_Config(); printf("\r\n Ұ��ISO-MINI�����壬˯��ʵ�� \r\n"); while(1) { /* wait interrupt */ LED1( ON ); // �� Delay(0xFFFFF); LED1( OFF ); // �� LED2( ON ); // �� Delay(0xFFFFF); LED2( OFF ); // �� LED3( ON ); // �� Delay(0xFFFFF); LED3( OFF ); // �� __WFI(); //����˯��ģʽ���ȴ��жϻ��� } }
static void led1_thread_entry(void* parameter) { /*在LED1线程中初始化LED的GPIO配置*/ LED_GPIO_Config(); while(1) { //rt_kprintf ( "\r\n LED1 is going!!!\r\n"); LED1(ON);//点亮LED1 rt_thread_delay(100);//调用RTT的API将当前线程挂起200ticks,也就是1sec LED1(OFF);//关闭LED1 rt_thread_delay(100); if(bMp3Play == 0) sys_wake_count++; if(sys_wake_count==sys_default_count) { sys_wake_count=0; if(sys_wake) { sys_wake=0; rt_kprintf("系统进入休眠状态,如需使用请唤醒!\r\n"); rt_mb_send(&mb,(rt_uint32_t)sys_down_mp3);//发送邮件 } } } }
/*检测是否有按键按下*/ void GetKey(void) { if(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_13)) { delay(1000000);//去抖动//去抖动 if(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_13)) { while(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_13)){ ; }//等待按键释放 can_tx(0X55,0X77); LED1(1);LED2(1); } } if(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12)) { delay(1000000);//去抖动//去抖动 if(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12)) { while(Bit_RESET == GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12)){ ; }//等待按键释放 can_tx(0X99,0Xbb); LED1(1);LED2(1); } } }
int main(void) { LED_GPIO_Config(); while (1) { delay_ms(500); LED1(OFF); delay_ms(500); LED1(ON); } }
void key_led_init(void) { LED_GPIO_Config(); LED1( ON ); /* exti line config */ EXTI_PA5_Config(); }
// IO 线中断,中断口为PC13 void EXTI15_10_IRQHandler(void) { if(EXTI_GetITStatus(EXTI_Line13) != RESET) //确保是否产生了EXTI Line中断 { /* 刚从停机唤醒,由于时钟未配置正确, 此printf语句的内容不能正常发送出去 */ printf("\r\n 进入中断 \r\n"); SYSCLKConfig_STOP(); //停机唤醒后需要启动HSE LED1( ON ); LED2( ON ); LED3( ON ); //点亮所有LED一段时间指示停机唤醒 Delay(0xFFFFFF); LED1( OFF ); LED2( OFF ); LED3( OFF ); /*由于前面已经重新启动了HSE, 所以本printf语句能正常发出 */ printf("\r\n 退出中断 \r\n"); EXTI_ClearITPendingBit(EXTI_Line13); //清除中断标志位 } }
/*----------------------------------------------------------------*/ void LED_Test(void) { /* LED 端口初始化 */ LED_GPIO_Config(); /* 方法2,使用固件库控制IO */ while (1) { LED1( ON ); // 亮 LED_Delay(0x0FFFFF); LED1( OFF ); // 灭 LED2( ON ); // 亮 LED_Delay(0x0FFFFF); LED2( OFF ); // 灭 LED3( ON ); // 亮 LED_Delay(0x0FFFFF); LED3( OFF ); // 灭 } }
void Task_LED(void *p_arg) { (void)p_arg; //'p_arg'没有用到,防止编译器警告 while(1) { LED1( ON ); OSTimeDlyHMSM(0,0,0,500); LED1( OFF ); LED2( ON ); OSTimeDlyHMSM(0,0,0,500); LED2( OFF ); LED3( ON ); OSTimeDlyHMSM(0,0,0,500); LED3( OFF ); LED4( ON ); OSTimeDlyHMSM(0,0,0,500); LED4( OFF ); } }
int main(void) { EXTI_PE5_Init(); KEY_Init(); LED_Init(); LED1(ON); LED2(ON); LED3(ON); while(1) { ; } }
static void App_TaskStart (void *p_arg) { (void)p_arg; /* Initialize BSP functions. */ OS_CPU_SysTickInit(); /* Initialize the SysTick. */ BSP_Init(); #if (OS_TASK_STAT_EN > 0) OSStatInit(); /* Determine CPU capacity. */ #endif /* 在此可创建事件 */ /* 在此可创建其他任务 */ //App_TaskCreate(); LED_GPIO_Conf(); while (1) { LED1(On); OSTimeDly(300); LED1(Off); OSTimeDly(300); MainTask(); } }
int main(void) { uint32_t color=0,i=0; LED_GPIO_Config(); glcd_init(); glcd_clear(BLUE); //timer_init(); glcd_set_colors(RED,BLUE); delay_ms(50); glcd_draw_hline(100,100,100); glcd_draw_hline(100,200,100); glcd_draw_vline(100,100,100); glcd_draw_vline(200,100,100); glcd_draw_string(1,1,"Hello My LCD"); glcd_draw_num(10,50,12345,5); delay_ms(50); glcd_set_colors(RED,GREEN); delay_ms(50); glcd_draw_circle(200,100,50); delay_ms(50); glcd_fill_circle(100,100,50); delay_ms(50); glcd_draw_rect(300,50,100,80); delay_ms(50); glcd_fill_rect(300,150,100,80); while (1) { debug("hello,I am xiaonong! This is line %d\r\n",++i); delay_ms(500); LED1(OFF); delay_ms(500); LED1(ON); // color = rand()%0xffffffff; // glcd_clear(color); } }
/** * @brief Main program. * @param None * @retval None */ int main(void) { LED_GPIO_Config(); SysTick_Init(); LED1(ON); LED3(ON); while (1) { LED2(ON); Delay_us(50000); LED2(OFF); Delay_us(50000); } }
/* * 函数名:main * 描述 : "主机"的主函数 * 输入 :无 * 输出 : 无 */ int main(void) { LED_GPIO_Config(); TIM2_Config(); USART2_Config(115200); LED1(OFF); LED2(OFF); Get_ChipID(); printf("USART2 Test OK!!\r\n"); printf("Chip ID is 0x%08X 0x%08X 0x%08X.\r\n", ChipUniqueID[0],ChipUniqueID[1],ChipUniqueID[2]); printf("Chip Size is %d KBytes.\r\n",(*(__IO uint32_t *)(0X1FFF7A22))&0xFFFF); while(1) { } }
void UDP_Test(void) { struct udp_pcb *UdpPcb; struct ip_addr ipaddr; struct pbuf *p; p = pbuf_alloc(PBUF_RAW,sizeof(UDPData),PBUF_RAM); if(p==NULL) return; p->payload=(void *)UDPData; UdpPcb=udp_new(); /* 建立UDP 通信的控制块(pcb) */ udp_bind(UdpPcb,IP_ADDR_ANY,8080); /* 绑定本地IP 地址 */ IP4_ADDR(&ipaddr,192, 168, 10, 100); udp_sendto(UdpPcb,p,&ipaddr,8080); /* 将收到的数据再发送出去 */ udp_recv(UdpPcb,UDP_Receive,NULL); /* 设置数据接收时的回调函数 */ LED1(1); LED2(1); LED3(1); }
/* * 函数名:main * 描述 :主函数 * 输入 :无 * 输出 :无 */ int main(void) { /* config the led */ LED_GPIO_Config(); LED1( ON ); /*config key*/ Key_GPIO_Config(); while(1) { if( Key_Scan(GPIOD,GPIO_Pin_12) == KEY_ON ) { if(GPIO_ReadOutputDataBit(GPIOD, GPIO_Pin_12)!= KEY_ON) { /*LED1-DS1反转*/ GPIO_WriteBit(GPIOE, GPIO_Pin_5, (BitAction)(1-(GPIO_ReadOutputDataBit(GPIOE, GPIO_Pin_5)))); } } } }
void rt_init_thread_entry(void* parameter) { rt_components_init(); LED_init(); Motor_Init(); rt_kprintf("start device init\n"); //rt_hw_i2c1_init(); i2cInit(); rt_hw_spi2_init(); rt_hw_spi3_init(); rt_event_init(&ahrs_event, "ahrs", RT_IPC_FLAG_FIFO); dmp_init(); sonar_init(); HMC5983_Init(); adns3080_Init(); //config_bt(); rt_thread_init(&led_thread, "led", led_thread_entry, RT_NULL, led_stack, 256, 16, 1); rt_thread_startup(&led_thread); spi_flash_init(); // bmp085_init("i2c1"); rt_kprintf("device init succeed\n"); if (dfs_mount("flash0", "/", "elm", 0, 0) == 0) { rt_kprintf("flash0 mount to /.\n"); } else { rt_kprintf("flash0 mount to / failed.\n"); } //default settings PID_Init(&p_rate_pid, 0, 0, 0); PID_Init(&r_rate_pid, 0, 0, 0); PID_Init(&y_rate_pid, 0, 0, 0); PID_Init(&p_angle_pid, 0, 0, 0); PID_Init(&r_angle_pid, 0, 0, 0); PID_Init(&y_angle_pid, 0, 0, 0); PID_Init(&x_v_pid, 0, 0, 0); PID_Init(&y_v_pid, 0, 0, 0); PID_Init(&x_d_pid, 0, 0, 0); PID_Init(&y_d_pid, 0, 0, 0); PID_Init(&h_pid, 0, 0, 0); load_settings(&settings, "/setting", &p_angle_pid, &p_rate_pid , &r_angle_pid, &r_rate_pid , &y_angle_pid, &y_rate_pid , &x_d_pid, &x_v_pid , &y_d_pid, &y_v_pid , &h_pid); settings.roll_min = settings.pitch_min = settings.yaw_min = 1000; settings.th_min = 1000; settings.roll_max = settings.pitch_max = settings.yaw_max = 2000; settings.th_max = 2000; // if(settings.pwm_init_mode) // { // Motor_Set(1000,1000,1000,1000); // // rt_thread_delay(RT_TICK_PER_SECOND*5); // // Motor_Set(0,0,0,0); // // settings.pwm_init_mode=0; // save_settings(&settings,"/setting"); // // rt_kprintf("pwm init finished!\n"); // } get_pid(); PID_Set_Filt_Alpha(&p_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&r_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&y_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&p_angle_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&r_angle_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&y_angle_pid, 1.0 / 75.0, 20.0); PID_Set_Filt_Alpha(&x_v_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&y_v_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&x_d_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&y_d_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&h_pid, 1.0 / 60.0, 20.0); rt_thread_init(&control_thread, "control", control_thread_entry, RT_NULL, control_stack, 1024, 3, 5); rt_thread_startup(&control_thread); rt_thread_init(&correct_thread, "correct", correct_thread_entry, RT_NULL, correct_stack, 1024, 12, 1); rt_thread_startup(&correct_thread); LED1(5); }
/* * 函数名:CMD_recv * 描述 :接收client端的数据 * 输入 :tcp_arg设置的参数,pcb结构体,pbuf,err错误变量 * 输出 : err_t * 调用 :内部调用 */ static err_t CMD_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { struct pbuf *q; struct dat *dat = (struct dat *)arg; int done; char *c; int i; /* We perform here any necessary processing on the pbuf */ if (p != NULL) //传入的pbuf非空 { /* We call this function to tell the LwIp that we have processed the data */ /* This lets the stack advertise a larger window, so more data can be received*/ tcp_recved(pcb, p->tot_len); //接收pbuf数据 /* Check the name if NULL, no data passed, return withh illegal argument error */ if(!dat) //为空时释放内存 { pbuf_free(p); return ERR_ARG; } done = 0; for(q=p; q != NULL; q = q->next) //q为pbuf的指针 { c = q->payload; //c获取pbuf中的数据指针payload for(i=0; i<q->len && !done; i++) { done = ((c[i] == '\r') || (c[i] == '\n')); //接收到回车 if(dat->length < MAX_NAME_SIZE) //把字符串保存到结构体 { dat->bytes[dat->length++] = c[i]; //保存payload中的数据到name结构体 } } } if(done) { /*在windows下,回车等于 \r\n 在linux下,回车等于 \n */ if(dat->bytes[dat->length-2] != '\r' || dat->bytes[dat->length-1] != '\n') { if((dat->bytes[dat->length-1] == '\r' || dat->bytes[dat->length-1] == '\n') && (dat->length+1 <= MAX_NAME_SIZE)) { dat->length += 1; //linux } else if(dat->length+2 <= MAX_NAME_SIZE) { dat->length += 2; //windows } else { dat->length = MAX_NAME_SIZE; //达到最大值的情况 } // name->bytes[name->length-2] = '\r'; //转化为标准的\r\n两个字符表示回车结束 // name->bytes[name->length-1] = '\n'; dat->bytes[dat->length-2] = '\0'; //加结束符,提取出bytes的数据 } if(strcmp(r_msg.user,"wildfire")==0) //已输入过用户名 { // printf("\r\n r_msg.user=%s",r_msg.user); if(strcmp(r_msg.PWD,"123456")==0) //已输入过密码 { strcpy(r_msg.CMD,dat->bytes); //复制命令 if(strcmp(r_msg.CMD,"LED1_ON")==0) //分析命令,开灯 { LED1(ON); tcp_write(pcb,STATUS_ON, strlen(STATUS_ON), 1);//控制成功 tcp_write(pcb,IN_CMD, strlen(IN_CMD), 1); //提示输入下一命令 } else if(strcmp(r_msg.CMD,"LED1_OFF")==0) //分析命令,关灯 { LED1(OFF); tcp_write(pcb,STATUS_OFF, strlen(STATUS_OFF), 1);//控制成功 tcp_write(pcb,IN_CMD, strlen(IN_CMD), 1); //提示输入下一命令 } else //查找不到命令 { tcp_write(pcb,CMD_ERR, strlen(CMD_ERR), 1); //命令错误 tcp_write(pcb,IN_CMD, strlen(IN_CMD), 1); //提示输入下一命令 } } else if(strcmp(dat->bytes,"123456")==0)//第一次输入密码,密码正确 { strcpy(r_msg.PWD,dat->bytes); //复制密码 tcp_write(pcb,IN_CMD, strlen(IN_CMD), 1); //提示输入下一命令 } else //密码错误 { tcp_write(pcb,PWD_ERR, strlen(PWD_ERR), 1); //密码错误 } } else //第一次输入用户名 { if(strcmp(dat->bytes,"wildfire")==0) //用户名正确 { strcpy(r_msg.user,dat->bytes); //正确,复制用户名 tcp_write(pcb,IN_PWD, strlen(IN_PWD), 1); //提示输入密码 } else//用户名错误 { tcp_write(pcb, USER_ERR, strlen(USER_ERR), 1); //用户名错误 tcp_write(pcb, IN_USER, strlen(IN_USER), 1); //提示再次输入 } } dat->length = 0; } /* End of processing, we free the pbuf */ pbuf_free(p); //释放pbuf } else if (err == ERR_OK) { /* When the pbuf is NULL and the err is ERR_OK, the remote end is closing the connection. */ /* We free the allocated memory and we close the connection */ mem_free(dat); return tcp_close(pcb); } return ERR_OK; }
/** * The task for generating button events, also does terminal and ping sending */ static void vButtonTask( int8_t *pvParameters ) { uint8_t event; uint8_t buttons = 0; uint8_t s1_count = 0; uint8_t s2_count = 0; int16_t byte; uint8_t i; uint8_t channel; pvParameters; N710_BUTTON_INIT(); vTaskDelay( 200 / portTICK_RATE_MS ); stack_event = stack_service_init(NULL); /* Open socket for stack status message */ channel = mac_current_channel(); while (1) { if(gw_assoc_state == 0 && scan_active == 0) { LED1_OFF(); scan_active=1; scan_start = xTaskGetTickCount(); gw_discover(); } /* Sleep for 10 ms or received from UART */ byte = debug_read_blocking(10 / portTICK_RATE_MS); if (byte != -1) { switch(byte) { case '1': /*send a button 1 event*/ event = 1; xQueueSend( button_events, ( void * ) &event, (portTickType) 0 ); break; case '2': /*send a button 2 event*/ event = 2; xQueueSend( button_events, ( void * ) &event, (portTickType) 0 ); break; case '\r': debug("\r\n"); break; case 'm': { sockaddr_t mac; rf_mac_get(&mac); debug("MAC: "); debug_address(&mac); debug("\r\n"); } break; case 'p': if(ping_active == 0) { echo_result.count=0; if(ping(NULL, &echo_result) == pdTRUE) /* Broadcast */ { ping_start = xTaskGetTickCount(); ping_active = 2; debug("Ping\r\n"); } else debug("No buffer.\r\n"); } break; case 'u': if(ping_active == 0) { echo_result.count=0; if(udp_echo(NULL, &echo_result) == pdTRUE) { ping_start = xTaskGetTickCount(); ping_active = 1; debug("udp echo_req()\r\n"); } else debug("No buffer.\r\n"); } break; /*case 'C': if (channel < 26) channel++; channel++; case 'c': if (channel > 11) channel--; mac_set_channel(channel); debug("Channel: "); debug_int(channel); debug("\r\n"); break;*/ default: debug_put(byte); } } /* Read button (S1 and S2) status */ if (N710_BUTTON_1 == 1) { if (s1_count > 5) { event = 1; if (s1_count >= 100) event |= 0x80; /*long keypress*/ xQueueSend( button_events, ( void * ) &event, (portTickType) 0 ); } s1_count = 0; } else { if (s1_count < 100) { s1_count++; } } if (N710_BUTTON_2 == 1) { if (s2_count > 5) { event = 2; if (s2_count >= 100) event |= 0x80; /*long keypress*/ xQueueSend( button_events, ( void * ) &event, (portTickType) 0 ); } s2_count = 0; } else { if (s2_count < 100) { s2_count++; } } /*LED blinkers*/ if (led1_count) { led1_count--; LED1_ON(); } else { LED1_OFF(); } if (led2_count) { led2_count--; LED2_ON(); } else { LED2_OFF(); } buttons = 0; if (LED1()) { buttons |= 1; } if (LED2()) { buttons |= 2; } ssi_sensor_update(3, (uint32_t) buttons); /* ping response handling */ if ((xTaskGetTickCount() - ping_start)*portTICK_RATE_MS > 1000 && ping_active) { debug("Ping timeout.\r\n"); stop_ping(); if(echo_result.count) { debug("Response: \r\n"); for(i=0; i<echo_result.count; i++) { debug_address(&(echo_result.result[i].src)); debug(" "); debug_int(echo_result.result[i].rssi); debug(" dbm, "); debug_int(echo_result.result[i].time); debug(" ms\r\n"); vTaskDelay(4); } echo_result.count=0; } else { debug("No response.\r\n"); } ping_active = 0; } /* stack events */ if(stack_event) { buffer_t *buffer = waiting_stack_event(10); if(buffer) { switch (parse_event_message(buffer)) { case BROKEN_LINK: buffer->dst_sa.port = datasensor_address.port; if(memcmp(&datasensor_address.address, &(buffer->dst_sa.address), 8) == 0) { gw_assoc_state = 0; datasensor_address.addr_type = ADDR_NONE; LED1_OFF(); } break; case ROUTER_DISCOVER_RESPONSE: scan_active=0; if(gw_assoc_state==0) { memcpy(datasensor_address.address, buffer->src_sa.address, 8); datasensor_address.addr_type = buffer->src_sa.addr_type ; gw_assoc_state=1; LED1_ON(); } break; default: break; } if(buffer) { socket_buffer_free(buffer); buffer = 0; } } } /*end stack events*/ if (scan_active == 1 && (xTaskGetTickCount() - scan_start)*portTICK_RATE_MS > 1000) { mac_gw_discover(); scan_start = xTaskGetTickCount(); } } /*end main loop*/ }
/* 主函数进口 */ int main(void) { /* RTC Configuration */ RTC_Configuration(); /* LED 端口初始化 */ LED_GPIO_Config(); SPI_RF24L01_Init(); RF24L01_Init(); /* 串口1初始化 */ USART1_Config(); /* 配置SysTick 为10us中断一次 */ SysTick_Init(); Delay_us(5000); // 50000 * 10us = 500ms printf("\r\n 这是一个 RF24L0124L01 无线传输实验 \r\n"); printf("\r\n 这是无线传输 主机端 的反馈信息\r\n"); printf("\r\n 正在检测RF24L01与MCU是否正常连接。。。\r\n"); /*检测RF24L01模块与MCU的连接*/ status = RF24L01_Check(); /*判断连接状态*/ if(status == SUCCESS) printf("\r\n RF24L01与MCU连接成功!\r\n"); else printf("\r\n RF24L01与MCU连接失败,请重新检查接线。\r\n"); // while(1) // { // RF24L01_TX_Mode(); // /*开始发送数据*/ // status = RF24L01_Tx_Dat(txbuf); // /*判断发送状态*/ // switch(status) // { // case MAX_RT: // printf("\r\n 主机端 没接收到应答信号,发送次数超过限定值,发送失败。 \r\n"); // break; // case ERROR: // printf("\r\n 未知原因导致发送失败。 \r\n"); // break; // case TX_DS: // printf("\r\n 主机端 接收到 从机端 的应答信号,发送成功! \r\n"); // break; // } // LED1( ON ); // 亮 // Delay_us(50000); // 50000 * 10us = 500ms // LED1( OFF ); // 灭 // LED2( ON ); // 亮 // Delay_us(50000); // 50000 * 10us = 500ms // LED2( OFF ); // 灭 // Delay_us(50000); // 50000 * 10us = 500ms // } LED1( OFF ); // 亮 while(1) { RF24L01_RX_Mode(); /*开始发送数据*/ LED1(OFF); // 灭 status = RF24l01_Rx_Dat(rxbuf); /*判断发送状态*/ switch(status) { case ERROR: printf("\r\n 未知原因导致接收失败。 \r\n"); break; case RX_DR: //printf("\r\n 主机端 接收到 从机端 的应答信号,发送成功! \r\n"); rxbuf[32] = 0; printf("\r\n Receive data is:%s \r\n",rxbuf);//打印接收到的数据 LED1(ON); // 灭 break; } } }