Rotating beacon light on Arduino

FunduinoPublished on

Den Blinkmodus einer Modell-Warnleuchte per Arduino wechseln

Die Rundumleuchte aus dem Modellbau hat mehrere Blinkmodi. Normalerweise schaltet man sie per Fernsteuerung um – hier übernimmt das der Arduino.

Du lernst, wie die Leuchte über ein Servosignal umgeschaltet wird, und wechselst den Modus mit einem kurzen Sketch automatisch.

The model beacon on the Funduino UNO, signal wire to pin 9

The beacon light

The model warning light comes from the model-building world, so it has a typical servo plug with three wires:

  • Red – 5V
  • Brown – GND
  • Yellow – Signal. This is used to switch the flashing mode.

You change the mode by adjusting the signal on the yellow wire: when it rises from about 30% to about 60%, the module detects the transition and switches to the next flashing mode. The signal can come from an RC receiver or a microcontroller.

For the servo connector, red is the power supply and brown is ground.

The model beacon on the Funduino UNO, signal wire to pin 9

Change the blink mode

The signal wire connects to pin 9. The sketch uses the Servo library to generate the signal: angle values from 54 to 110 correspond to the 30 to 60% in the description.

In each cycle, the value increases in small steps from 54 to 110. The sketch then waits one second, the value jumps back to 54, and the light changes mode again as the value increases next time.

Change the beacon's flashing mode
#include <Servo.h>
int pos=0; // Variable for the PWM signal
Servo alarm;
void setup()
{
alarm.attach(9);  // The warning light is connected to pin 9 via the signal wire
}
void loop()
{
for (pos = 54; pos <= 110; pos += 1) // This is where a loop begins that raises the PWM signal from 30% to 60%. Since the Servo library is used for the PWM signal, the percentage is represented analogously by the rotation angles between 54 and 110.
 {
 alarm.write(pos);    // Output the PWM signal to the module
 delay(10);          // The signal remains active for 10 ms
 }
delay (1000);
}
Rate the instructions

Comments

Ask a question or share an experience

Contact us if something doesn’t work. Please include your board and the error message.

We review every comment before publication. Your email address remains with us.