云端给开发板发送指令然后实现小灯翻转
This commit is contained in:
parent
a0ae37543c
commit
43846001be
@ -51,10 +51,12 @@ static void example_message_arrive(void *pcontext, void *pclient, iotx_mqtt_even
|
||||
rt_pin_mode(GPIO_LED_R, PIN_MODE_OUTPUT);
|
||||
if(rt_pin_read(GPIO_LED_R) == PIN_HIGH)
|
||||
{
|
||||
// rt_kprintf("LED_R should be ON\n");
|
||||
rt_pin_write(GPIO_LED_R, PIN_LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
// rt_kprintf("LED_R should be OFF\n");
|
||||
rt_pin_write(GPIO_LED_R, PIN_HIGH);
|
||||
}
|
||||
EXAMPLE_TRACE("Topic : %.*s", topic_info->topic_len, topic_info->ptopic);
|
||||
|
@ -63,14 +63,14 @@
|
||||
int main(void)
|
||||
{
|
||||
main_init();
|
||||
rt_pin_mode(GPIO_LED_B, PIN_MODE_OUTPUT);
|
||||
while(1)
|
||||
{
|
||||
rt_pin_write(GPIO_LED_B, PIN_HIGH);
|
||||
rt_thread_mdelay(500);
|
||||
rt_pin_write(GPIO_LED_B, PIN_LOW);
|
||||
rt_thread_mdelay(500);
|
||||
}
|
||||
// rt_pin_mode(GPIO_LED_B, PIN_MODE_OUTPUT);
|
||||
// while(1)
|
||||
// {
|
||||
// rt_pin_write(GPIO_LED_B, PIN_HIGH);
|
||||
// rt_thread_mdelay(500);
|
||||
// rt_pin_write(GPIO_LED_B, PIN_LOW);
|
||||
// rt_thread_mdelay(500);
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user