Android Example Torch plus Morse code from the Flash and the Vibrator

The attached project has a dual purpose:
1. Send Morse Codes with the camera flash
2. Serve as a Torch

The Morse Code functionality might be useful when you are lost in mid ocean and need to attract the attention of a ship passing by at night...Hopefully you have a solar charger with you else this might be of no use whatsoever. It was done just for the fun of it.

The project was tested on my Samsung S4 mini and also by @adrianstanescu85 on his Galaxy Note 3

Java code comes from here:
http://code.google.com/p/koko-morse...t/fhj/swd/FlashOutputAct.java?spec=svn16&r=16
and
http://stackoverflow.com/questions/15101912/morse-code-conversion-using-java

Adapted/amended the code a bit to fit B4A

Also uploading the final java package in case someone wants to amend or modify it.

The Morse code part of the project supports the following characters:
. , @ & _ - + = : & ( ) ! ? /
0 to 9
a to z
A to Z
 

Attachments

  • JHSflashMorse.zip
    84.4 KB · Views: 1,156
  • morseCode1.zip
    2.8 KB · Views: 920

Johan Schoeman

Expert
Licensed User
Longtime User
I wanted to add a toast message that would be displayed once the transmission of the Morse code has been completed. Attached are the new jar and xml files as well as the java code of the Morse code part of the library. The amendment/addition to the java code is based on what I found here
 

Attachments

  • fiddleAround.zip
    49 KB · Views: 682
  • morseCode1.zip
    3.2 KB · Views: 659
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
The attached project is just an extension of the above projects - purely done as a java learning exercise creating the library. This project now includes a torch as well as the ability to either flash or vibrate a Morse code (at 4 different rates). Updated library files are in the /files folder of the project.
 

Attachments

  • JhsFlashVibMorse.zip
    99.9 KB · Views: 783

Johan Schoeman

Expert
Licensed User
Longtime User
This is my last and final attempt at this. Have changed the library and project to allow the ON/OFF time of the vibrator or flash (when sending Morse Codes) to be set via a Seekbar. The Seekbar (Value ranging from 0 to 100) allows you to adjust the time of a "dit" between 50ms and 500ms. The "dah" and spaces between words will follow the lead of the "dit"

See attached project. New library files are in the /files folder. Copy them to (or replace them in) your additional library folder. Also, use the attached project as it contains the necessary changes to accommodate the Seekbar option.

Also posting the Java code for both the Morse vibrator and Morse flash.
 

Attachments

  • JhsFlashVibMorseWithSeekbar.zip
    99.8 KB · Views: 809
  • The Java Code.zip
    6 KB · Views: 691
Last edited:

khosrwb

Active Member
Licensed User
Longtime User
111.PNG
hi
when I run app
show me this error
How do I find the library? (( B4AMorseCode1 ))(( B4Aflash ))
 

Troberg

Well-Known Member
Licensed User
Longtime User
One small note: The most likely use for the Morse code is to send an SOS, so maybe you should have support for the SOS character (SOS is sent as a single sequence, without pauses, to differentiate it from other sequences of those Three characters) as well.
 

Johan Schoeman

Expert
Licensed User
Longtime User
One small note: The most likely use for the Morse code is to send an SOS, so maybe you should have support for the SOS character (SOS is sent as a single sequence, without pauses, to differentiate it from other sequences of those Three characters) as well.
Use the project here if you want to accommodate SOS without any pauses - change the code to check for SOS sequence of chars and then ignore the pauses. Java code is inside the project.
 
Top