A simple example showing how to control gamepad LED colors with smooth transitions in Godot Engine 4.6.
- Control gamepad LED color via Godot's Input system
- Smooth color transitions using lerp
- Automatic color cycling every 0.5 seconds
- Support for multiple gamepads (adjustable device_id)
- Clone the repository
- Open godot_project in Godot 4.6+
- Connect a compatible gamepad (PS4/PS5)
- Run the project
The code cycles through four colors (red, green, blue, yellow) with smooth transitions:
# Set LED color
Input.set_joy_light(device_id, current_color)
# Smooth transition between colors
current_color = current_color.lerp(target_color, delta * fade_speed)device_id: Gamepad device number (default: 0 = first connected gamepad)colors: Array of Color objects to cycle throughfade_speed: Transition speed (default: 2)timer.wait_time: Time between color changes (default: 0.5 seconds)
- Godot Engine 4.6 or newer
- Compatible gamepad (PS4, PS5, or similar with LED support)
