You can use an ultrasonic sensor and an Arduino nano to measure the distance between your bike and a passing car.
It is recommended to keep a distance of 1.5 meters.
If the car is too close the LEDs start to flash.
- VS code with platform.io extension
- one Arduino Nano or Uno
- one HC-SR04
- a few WS2812 compatible LEDs
- many wire
- a soldering iron