main.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-11-08 Dailingxiang first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <board.h>
  13. /* defined the LED0 pin: PC2 */
  14. #define LED0_PIN GET_PIN(C, 2)
  15. /* defined the LED1 pin: PC1 */
  16. #define LED1_PIN GET_PIN(C, 1)
  17. /* defined the LED2 pin: PC0 */
  18. #define LED2_PIN GET_PIN(C, 0)
  19. int main(void)
  20. {
  21. /* set LED0 pin mode to output */
  22. rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
  23. /* set LED1 pin mode to output */
  24. rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
  25. /* set LED2 pin mode to output */
  26. rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
  27. while (1)
  28. {
  29. rt_pin_write(LED0_PIN, PIN_HIGH);
  30. rt_pin_write(LED1_PIN, PIN_HIGH);
  31. rt_pin_write(LED2_PIN, PIN_HIGH);
  32. rt_thread_mdelay(500);
  33. rt_pin_write(LED0_PIN, PIN_LOW);
  34. rt_pin_write(LED1_PIN, PIN_LOW);
  35. rt_pin_write(LED2_PIN, PIN_LOW);
  36. rt_thread_mdelay(500);
  37. }
  38. return RT_EOK;
  39. }