Netgate 2100 Customization of LEDs (Guide)
-
Photos Restored Jan 28 23:36
- 19 days later
-
I’m trying to figure out how I can modify this to work with system status? Specifically I would like to set all the led’s on my 4200 to bright red when the wan gateway is down. Not finding a bash script to do this though.
-
You can.. all you would have to do is find some WAN connection you can use with a variable with pfctl -vsss
maybe just search for any WAN connections if you have a static IP it would be the best just search for that IP address with.So really basic "if else" it could be..
if-->
WAN not found
turn LEDs RED!!!
else-->
turn LEDS off or GREENuse this command in shell to find something that would work...
pfctl -vvss
To make all the LEDS red on 2100 is...
sysctl -q dev.gpio.2.led.0.pwm=0 gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=0 gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null
So basically ...
#!/bin/sh check_current_states=$( pfctl -vvss | grep -e ‘STATIC WAN IP ADDRESS HERE’ ) WAN=1 case "$check_current_states" in *WAN IP* ) WAN=1 ;; esac if [ $WAN = 0 ]; #meaning if it is offline turn them to red then sysctl -q dev.gpio.2.led.0.pwm=0 gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=0 gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null else #turn all LEDs off or what ever you need.... sysctl -q dev.gpio.2.led.0.pwm=1 gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null gpioctl -f /dev/gpioc2 1 duty 0 >/dev/null gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null gpioctl -f /dev/gpioc2 5 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null fi
Or for the else condition you could set it to green if WAN is online
sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 50 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
Make a cron job to run the scrip every so often to check...
keep in mind you would have to also disable the current LEDS too
sysctl -q dev.gpio.2.led.0.pwm=1 gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null gpioctl -f /dev/gpioc2 1 duty 0 >/dev/null gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null gpioctl -f /dev/gpioc2 5 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
or just create a while loop to do that..
-
Side Note:
if your 4200 has lots of traffic... I am talking thousands of clients... running pfctl over and over every minute might not be for you,, as it takes up some memory when you do this..
However for a small office or a dozen or so clients this is no big deal....
-
@JonathanLee
So I could just use something like 8.8.8.8 for the static WAN? -
@wgstarks That's the DNS yes if the gateway went offline I am sure that state would no longer exist. Try that unplug wan for 10 mins see if it glows red plug it v=back in wait ten mins see if it normalizes. Great idea
-
@JonathanLee
Do you know what the factory default is for the “or else”? -
I think it is very close too..
sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 8 duty 30 >/dev/null
it pulses blue like that... I never used the default once I went to custom blinking light mode
Remember you have to disable the others before you change it back with
sysctl -q dev.gpio.2.led.0.pwm=1 gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null gpioctl -f /dev/gpioc2 1 duty 0 >/dev/null gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null gpioctl -f /dev/gpioc2 5 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
This would be like a reset turns them all off..
-
@JonathanLee
Thanks. Might be simpler to just set it to red and green. I never remember what the default patterns mean anyway. -
@wgstarks One other item with the custom LEDs you will not see the firmware LED program run so I added a email alert for updates program with it that another user shared on Netgate...
https://forum.netgate.com/topic/137707/auto-update-check-checks-for-updates-to-base-system-packages-and-sends-email-alerts/
That way you still get a alert that you have updates without the Orange LED
-
Thanks. Have had that installed for a while.
-
@stephenw10 Can you please help me?
Where is the standard led program in pfSense filesystem located it would be easier to just call that program if the gateway is up for @wgstarks request. He wants to normalize the LED behavior if the gateway is up. I could just set the scrip to call that program if needed. /dev/led is not listed in 2100 file system -
To normalize it call this program originally sets bootup conditions, I am searching for the file it calls
/usr/local/sbin/pfSense-led.sh
-
set the program to call
/usr/local/sbin/pfSense-led.sh ready
Use that for the else condition that would normalize it automatically for your model
-
Thanks. I’ll test this and see if I can get it working.
-
This post is deleted! -
I got it don't use DNS use the interfaces name and pinger
pfctl -vvss | grep -e "mvneta0 icmp"
that works!!!
#!/bin/sh led_intensity=0 while [ $led_intensity -le 8 ]; do gpioctl -f /dev/gpioc2 $led_intensity duty 0 >/dev/null led_intensity=$(( led_intensity + 1 )) done check_current_states=$( pfctl -vvss | grep -e "mvneta0 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then sysctl -q dev.gpio.2.led.0.pwm=0 gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=0 gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null else /usr/local/sbin/pfSense-led.sh ready fi
Your mvneta0 might be different over the 2100 check it on Interface Assignments, that is the pinger state used to check to see if gateway is up just use it for the program also
YEAH!!
Just updated after testing 4:07 7-18-24
-
Update to mine to reflect the gateway offline
#!/bin/sh check_current_states=$( pfctl -vvss | grep -e ', rule 105' -e ', rule 52' -e '192.168.1.11' -e '192.168.1.15' -e 'mvneta0 icmp' ) res=1 resb=1 resc=1 resd=1 WAN=1 case "$check_current_states" in *icmp* ) WAN=0 ;; esac if [ $WAN = 1 ]; then sysctl -q dev.gpio.2.led.0.pwm=0 gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=0 gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null exit 1 fi case "$check_current_states" in *", rule 105"* ) res=0 ;; esac case "$check_current_states" in *192.168.1.11* ) resb=0 ;; esac case "$check_current_states" in *192.168.1.15* ) resc=0 ;; esac case "$check_current_states" in *", rule 52"* ) resd=0 ;; esac if [ $res = 0 ] && [ $resb = 0 ]; then sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null gpioctl -f /dev/gpioc2 4 duty 15 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 55 >/dev/null gpioctl -f /dev/gpioc2 7 duty 20 >/dev/null gpioctl -f /dev/gpioc2 8 duty 15 >/dev/null elif [ $res = 0 ]; then sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 55 >/dev/null gpioctl -f /dev/gpioc2 7 duty 20 >/dev/null gpioctl -f /dev/gpioc2 8 duty 15 >/dev/null elif [ $resb = 0 ]; then sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null gpioctl -f /dev/gpioc2 4 duty 15 >/dev/null else sysctl -q dev.gpio.2.led.1.pwm=1 gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=1 gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null gpioctl -f /dev/gpioc2 7 duty 50 >/dev/null gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null fi if [ $resc = 0 ] || [ $resd = 0 ]; then sysctl -q dev.gpio.2.led.0.pwm=1 gpioctl -f /dev/gpioc2 2 duty 50 >/dev/null gpioctl -f /dev/gpioc2 0 duty 50 >/dev/null else sysctl -q dev.gpio.2.led.0.pwm=1 gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null fi
-
When I test in shell I get the following result-
gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory gpio_open: No such file or directory
My script-
#!/bin/sh led_intensity=0 while [ $led_intensity -le 8 ]; do gpioctl -f /dev/gpioc2 $led_intensity duty 0 >/dev/null led_intensity=$(( led_intensity + 1 )) done check_current_states=$( pfctl -vvss | grep -e "igc3 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then sysctl -q dev.gpio.2.led.0.pwm=0 gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null sysctl -q dev.gpio.2.led.1.pwm=0 gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null sysctl -q dev.gpio.2.led.2.pwm=0 gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null else /usr/local/sbin/pfSense-led.sh ready fi
-
Do me a favor take a look in
/usr/local/sbin/pfSense-led.shFind your model firewall and tell me what directive is used to change the LEDS…
Also peek in /dev/led see if you have that folder, if you do it should be easy to adapt with the directive used for your model
-
@JonathanLee said in Netgate 2100 Customization of LEDs (Guide):
Do me a favor take a look in
/usr/local/sbin/pfSense-led.shFind your model firewall and tell me what directive is used to change the LEDS…
Maybe this is what you need.
# Netgate 4200 # 4200_led_off() { local _leds="red_0 green_0 blue_0 red_1 green_1 blue_1 red_2 green_2 blue_2" for led in ${_leds}; do echo 0 > /dev/led/${led} done } 4200_led_booting() { 4200_led_off # Fast blink blue on all LEDs echo f2 > /dev/led/blue_0 echo f2 > /dev/led/blue_1 echo f2 > /dev/led/blue_2 } 4200_led_ready() { 4200_led_off # Left LED solid blue echo 1 > /dev/led/blue_2 } 4200_led_update() { # Purple on center LED echo 1 > /dev/led/red_1 echo 0 > /dev/led/green_1 echo 1 > /dev/led/blue_1 } 4200_led_update_off() { # Turn off center LED only echo 0 > /dev/led/red_1 echo 0 > /dev/led/green_1 echo 0 > /dev/led/blue_1 } 4200_led_updating() { 4200_led_off # Fast green blink on all LEDs echo f2 > /dev/led/green_0 echo f2 > /dev/led/green_1 echo f2 > /dev/led/green_2 }
-
@wgstarks said in Netgate 2100 Customization of LEDs (Guide):
echo f2 > /dev/led/blue_0
echo f2 > /dev/led/blue_1
echo f2 > /dev/led/blue_2try this one
#!/bin/sh echo 0 > /dev/led/blue_0 echo 0 > /dev/led/blue_1 echo 0 > /dev/led/blue_2 echo 0 > /dev/led/red_0 echo 0 > /dev/led/red_1 echo 0 > /dev/led/red_2 echo 0 > /dev/led/green_0 echo 0 > /dev/led/green_1 echo 0 > /dev/led/green_2 check_current_states=$( pfctl -vvss | grep -e "igc3 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then echo f2 > /dev/led/red_0 echo f2 > /dev/led/red_1 echo f2 > /dev/led/red_2 else /usr/local/sbin/pfSense-led.sh ready fi
Or to just turn on solid red
#!/bin/sh echo 0 > /dev/led/blue_0 echo 0 > /dev/led/blue_1 echo 0 > /dev/led/blue_2 echo 0 > /dev/led/red_0 echo 0 > /dev/led/red_1 echo 0 > /dev/led/red_2 echo 0 > /dev/led/green_0 echo 0 > /dev/led/green_1 echo 0 > /dev/led/green_2 check_current_states=$( pfctl -vvss | grep -e "igc3 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then echo 1 > /dev/led/red_0 echo 1 > /dev/led/red_1 echo 1 > /dev/led/red_2 else /usr/local/sbin/pfSense-led.sh ready fi
Please let me know if that works unplug wan it should come on red when you test it.
After set your cron job to what ever amount of timer you want every min check it or whatever you want. Mine runs every min
make sure you chmod the file also so it can run.
if you want just do a chmod 777 on it and or a more secure privilege.
I have some that run in the day and some at night so this is my 6am - 8:59 one
-
@JonathanLee said in Netgate 2100 Customization of LEDs (Guide):
@wgstarks said in Netgate 2100 Customization of LEDs (Guide):
echo f2 > /dev/led/blue_0
echo f2 > /dev/led/blue_1
echo f2 > /dev/led/blue_2try this one
#!/bin/sh echo 0 > /dev/led/blue_0 echo 0 > /dev/led/blue_1 echo 0 > /dev/led/blue_2 echo 0 > /dev/led/red_0 echo 0 > /dev/led/red_1 echo 0 > /dev/led/red_2 echo 0 > /dev/led/green_0 echo 0 > /dev/led/green_1 echo 0 > /dev/led/green_2 check_current_states=$( pfctl -vvss | grep -e "igc3 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then echo f2 > /dev/led/red_0 echo f2 > /dev/led/red_1 echo f2 > /dev/led/red_2 else /usr/local/sbin/pfSense-led.sh ready fi
Or to just turn on solid red
#!/bin/sh echo 0 > /dev/led/blue_0 echo 0 > /dev/led/blue_1 echo 0 > /dev/led/blue_2 echo 0 > /dev/led/red_0 echo 0 > /dev/led/red_1 echo 0 > /dev/led/red_2 echo 0 > /dev/led/green_0 echo 0 > /dev/led/green_1 echo 0 > /dev/led/green_2 check_current_states=$( pfctl -vvss | grep -e "igc3 icmp" ) WAN=0 case "$check_current_states" in *icmp* ) WAN=1 ;; esac if [ $WAN = 0 ]; then echo 1 > /dev/led/red_0 echo 1 > /dev/led/red_1 echo 1 > /dev/led/red_2 else /usr/local/sbin/pfSense-led.sh ready fi
Please let me know if that works unplug wan it should come on red when you test it.
After set your cron job to what ever amount of timer you want every min check it or whatever you want. Mine runs every min
make sure you chmod the file also so it can run.
if you want just do a chmod 777 on it and or a more secure privilege.
I have some that run in the day and some at night so this is my 6am - 8:59 one
I like the blinking red. More of an attention getter IMO. Working beautifully. Thanks for the script and the help.
-
Is it possible to increase the brightness? And blink all three?
-
@wgstarks said in Netgate 2100 Customization of LEDs (Guide):
IMO
Great, no problem enjoy. I have one that turns purple when my wife has her work stuff on... royal purple means do not mess with firewall when she is working... haha
-
@wgstarks that you would need to ask an official Netgate rep about, I only have a 2100 so I can only use the directives that my model uses.
I wonder if you can also...
@stephenw10 Do you know what the LED intensity directive is on the 4200?
-
Only the first and third led's are blinking. I'm fairly sure the code is for all three right? I wonder if it's possible to test them?
-
@wgstarks does the 2nd glow red? The f2 directive might only work for led 0 and 2 test with the echo command
-
@JonathanLee said in Netgate 2100 Customization of LEDs (Guide):
@wgstarks does the 2nd glow red?
No but I see 0,1 and 2 in the code so wondering if it's a bad led.
-
@wgstarks check the file in /dev/led red 2
-
@JonathanLee said in Netgate 2100 Customization of LEDs (Guide):
@wgstarks check the file in /dev/led red 2
Can't open that file. the led directory is locked (555).
-
-
@wgstarks can you cat the file?
-
@JonathanLee said in Netgate 2100 Customization of LEDs (Guide):
@wgstarks can you cat the file?
Operation not supported by device.
-
@wgstarks look at the open source file on GitHub it’s all open source, git hub should be open non locked
-
@wgstarks someone made a Morse code LED messager you know the one you use the application on your phone for ? That is cool
<?php /* * led.inc * * part of pfSense (https://www.pfsense.org) * Copyright (c) 2009-2013 BSD Perimeter * Copyright (c) 2013-2016 Electric Sheep Fencing * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ $led_root = "/dev/led/led"; /* * Send the control string to an LED */ function led_ctl($led, $str) { global $led_root; if (led_exists($led)) { exec("/bin/echo " . escapeshellarg($str) . " > {$led_root}{$led}"); return true; } return false; } /* * Blink an LED at set speed from 1-9 (1=Very Fast, 9=Very Slow) */ function led_blink($led, $speed = 0) { switch ($speed) { case "reallyfast": case "veryfast": $speed = 1; break; case "fast": $speed = 3; break; case "medium": $speed = 5; break; case "slow": $speed = 7; break; case "reallyslow": case "veryslow": $speed = 9; break; } if (is_numeric($speed) && ($speed > 0) && ($speed < 10)) { return led_ctl($led, "f{$speed}"); } return false; } /* * Blink an LED in a specific pattern * Letters A-J are on from 1/10s to 1s * Letters a-j are off from 1/10s to 1s */ function led_pattern($led, $pattern, $repeat = true) { /* End with a . to stop after one iteration. */ $end = $repeat ? "" : "."; return led_ctl($led, "s{$pattern}{$end}"); } /* * Encode a text message into morse code, and send it to an LED */ function led_morse($led, $message) { return led_ctl($led, "m" . str_to_morse($message)); } /* * Blink digits out on LED at 1/10s intervals * e.g 1=1 blink, 8=8 blinks * 0 is 10 pulses. * One second pause between digits. */ function led_digit($led, $digitstring) { $i = 0; $dstring = "d"; while ($i < strlen($digitstring)) { $thisdigit = substr($digitstring, $i++, 1); if (is_numeric($thisdigit)) { $dstring .= $thisdigit; } } led_ctl($led, $dstring); } /* * Turn an LED on */ function led_on($led) { led_ctl($led, "1"); } /* * Turn an LED off */ function led_off($led) { led_ctl($led, "0"); } /* * Find the number of LEDs present on the system. */ function led_count() { global $led_root; $count = 0; $leds = array(); if (is_dir(dirname($led_root))) { $leds = glob("{$led_root}*"); $count = count($leds); } return $count; } /* * Test to see if a given LED exists. */ function led_exists($led) { global $led_root; if (!is_numeric($led)) { return false; } return file_exists("{$led_root}{$led}"); } /* * Sweep across three LEDs in a K.I.T.T.-like way. */ function led_kitt() { if (led_count() != 3) { /* Wrong LED count for this to work, skip. */ return; } led_pattern(1, 'AaaaaA'); led_pattern(2, 'aAaaAa'); led_pattern(3, 'aaAAaa'); } /* * Custom pattern for assigning interfaces */ function led_assigninterfaces() { if (led_count() != 3) { /* Wrong LED count for this to work, skip. */ return; } led_pattern(1, 'AaaAaaaaaaaaaaaa'); led_pattern(2, 'aaaaaAaaAaaaaaaa'); led_pattern(3, 'aaaaaaaaaaAaaAaa'); } /* * Return the three LEDs to a standard setup (1=on, 2 and 3 = off) */ function led_normalize() { if (led_count() != 3) { /* Wrong LED count for this to work, skip. */ return; } led_on(1); led_off(2); led_off(3); } /* * Shut off ALL LEDs. */ function led_alloff() { if (led_count() != 3) { /* Wrong LED count for this to work, skip. */ return; } led_off(1); led_off(2); led_off(3); } /* * Translate a string to morse code. Characters not known to have a * valid morse code representation will be ignored. */ function str_to_morse($string) { $i = 0; $morsestring = ""; while ($i < strlen($string)) { $morsestring .= char_to_morse(substr($string, $i++, 1)) . " "; } return $morsestring . "\n"; } /* * Translate a single character to morse code. Characters not known * to have a valid morse code representation will be ignored. */ function char_to_morse($char) { switch (strtoupper($char)) { case "A": return ".-"; break; case "B": return "-..."; break; case "C": return "-.-."; break; case "D": return "-.."; break; case "E": return "."; break; case "F": return "..-."; break; case "G": return "--."; break; case "H": return "...."; break; case "I": return ".."; break; case "J": return ".---"; break; case "K": return "-.-"; break; case "L": return ".-.."; break; case "M": return "--"; break; case "N": return "-."; break; case "O": return "---"; break; case "P": return ".--."; break; case "Q": return "--.-"; break; case "R": return ".-."; break; case "S": return "..."; break; case "T": return "-"; break; case "U": return "..-"; break; case "V": return "...-"; break; case "W": return ".--"; break; case "X": return "-..-"; break; case "Y": return "-.--"; break; case "Z": return "--.."; break; case "0": return "-----"; break; case "1": return ".----"; break; case "2": return "..---"; break; case "3": return "...--"; break; case "4": return "....-"; break; case "5": return "....."; break; case "6": return "-...."; break; case "7": return "--..."; break; case "8": return "---.."; break; case "9": return "----."; break; case ".": return ".-.-.-"; break; case ",": return "--..--"; break; case "?": return "..--.."; break; case "'": return ".----."; break; case "!": return "-.-.--"; break; case "/": return "-..-."; break; case "(": return "-.--."; break; case ")": return "-.--.-"; break; case "&": return ".-..."; break; case ":": return "---..."; break; case ";": return "-.-.-."; break; case "=": return "-...-"; break; case "+": return ".-.-."; break; case "-": return "-....-"; break; case "_": return "..--.-"; break; case "$": return "...-..-"; break; case "@": return ".--.-."; break; case '"': return ".-..-."; break; default: return ""; break; } } ?>