Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. /***************************
  2. RoboCar LED Control Program
  3. **************************/
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <unistd.h>
  8.  
  9. #include "uart_api.h"
  10. #include "robot_protocol.h"
  11.  
  12. int main(void)
  13. {
  14. int ret;
  15. char led_brightness;
  16.  
  17. ret = user_uart1_open("S1"); // UART Device connected to RoboCar
  18.  
  19. if (ret < 0)
  20. {
  21. printf("\n UART1 open error!");
  22. exit(0);
  23. }
  24.  
  25. user_uart1_confing(115200, 8, UART_PARNONE, 1);
  26.  
  27. for (led_brightness = 0; led_brightness <= 100; led_brightness += 10)
  28. {
  29. RoboCAR_FrontLED_Control(led_brightness);
  30. RoboCAR_BackLED_Control(100-led_brightness);
  31.  
  32. printf("\n Front LED Brightness %d %\n", led_brightness);
  33. printf(" Back LED Brightness %d % \n", 100-led_brightness);
  34.  
  35. sleep(1);
  36. }
  37.  
  38. user_uart1_close();
  39.  
  40. return 0;
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement