Advertisement
b-7

PS5 CONTROLLER LED LOOP

b-7
Mar 11th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. int count = 0;
  2.  
  3. main {
  4. // Define all PS5 buttons
  5. define PS5_TRIANGLE = PS4_TRIANGLE;
  6. define PS5_CIRCLE = PS4_CIRCLE;
  7. define PS5_CROSS = PS4_CROSS;
  8. define PS5_SQUARE = PS4_SQUARE;
  9. define PS5_UP = PS4_UP;
  10. define PS5_DOWN = PS4_DOWN;
  11. define PS5_LEFT = PS4_LEFT;
  12. define PS5_RIGHT = PS4_RIGHT;
  13. define PS5_TOUCH = PS4_TOUCH;
  14. define PS5_OPTIONS = PS4_OPTIONS;
  15. define PS5_SHARE = PS4_SHARE;
  16. define PS5_L1 = PS4_L1;
  17. define PS5_L2 = PS4_L2;
  18. define PS5_R1 = PS4_R1;
  19. define PS5_R2 = PS4_R2;
  20. define PS5_PS = PS4_PS;
  21.  
  22. // Set LED colors to random values
  23. int red = rand(0, 255);
  24. int green = rand(0, 255);
  25. int blue = rand(0, 255);
  26. set_led_color(red, green, blue);
  27.  
  28. // Wait for 100ms
  29. wait(100);
  30.  
  31. // Increase count
  32. count++;
  33.  
  34. // If count is a multiple of 10, set new random LED colors
  35. if (count % 10 == 0) {
  36. red = rand(0, 255);
  37. green = rand(0, 255);
  38. blue = rand(0, 255);
  39. }
  40.  
  41. // If count is greater than or equal to 50, reset count
  42. if (count >= 50) {
  43. count = 0;
  44. }
  45.  
  46. // Repeat main loop
  47. goto main;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement