# LED Antenna Alignment - MikroTik Script RouterOS

    Here is a short script I wrote to use the onboard LED on the RB532 for antenna alignment.

    The LED blinks a number of times in a second. The more blinks, the higher the SNR.

    Currently it will only show the SNR of the first entry in the Registrations tab in the Wireless window. This should not be a problem, since you will most likely use this tool for CPE alignment or when setting up a point to point link, where you only have 1 entry in the Registrations tab.

    It can be modified to look for a specific MAC address or SSID.

    Put the following as a System / Script entry.

    :global if-snr [ /interface wireless registration-table get [/interface wireless registration-table find] signal-to-noise ]
    :if (($if-snr > 0) && ($if-snr <= 15 )) do={/blink duration=250ms}
    :if (($if-snr > 15) && ($if-snr <= 25 )) do={/blink duration=500ms}
    :if (($if-snr > 25) && ($if-snr <= 35 )) do={/blink duration=750ms}
    :if ($if-snr > 35 ) do={/blink duration=1s}
    Use scheduler to run the script every 1 or 2 seconds (your preference). In the 'On Event' box type:

    /system script run [/system script find name=blinkled]
    # [WHERE blinkled IS THE NAME OF THE SCRIPT SHOWN ABOVE]
    RouterOS 5.13 doesn't like the "-" in the variable name if-snr, so use ifsnr instead

    Credit: wiki.mikrotik.com