Giter Site home page Giter Site logo

paschalis / morse-code-converter Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.35 MB

A terminal-based Morse code converter tool for PC, implemented in both C and C++. The project demonstrates the use of threads, semaphores, and C/C++ programming features such as pointers and structs. This repository serves as a reference implementation for a similar project targeting microcontrollers.

License: MIT License

Makefile 3.95% C 51.35% C++ 44.70%

morse-code-converter's Introduction

Morse Code Converter

Project Image

This is a simple Morse code converter program written in both C and C++. It allows you to convert text to Morse code and vice versa. Additionally, it supports custom Morse code mappings.

๐Ÿ› ๏ธ Features

  • Convert text to Morse code.
  • Convert Morse code to text.
  • Support for custom Morse code mappings.

๐Ÿ“ Folder Structure (C and C++)

  • ๐Ÿ“ c_version
    • ๐Ÿ“‚ build
    • ๐Ÿ“ src
      • ๐Ÿ“„ main.c
      • ๐Ÿ“„ morse.c
      • ๐Ÿ“„ morse.h
      • ๐Ÿ“„ thread_utils.c
      • ๐Ÿ“„ thread_utils.h
    • ๐Ÿ“„ Makefile
    • ๐Ÿ“„ morse_converter
  • ๐Ÿ“ cpp_version
    • ๐Ÿ“‚ build
    • ๐Ÿ“ src
      • ๐Ÿ“„ main.cpp
      • ๐Ÿ“„ morse.cpp
      • ๐Ÿ“„ morse.h
      • ๐Ÿ“„ thread_utils.cpp
      • ๐Ÿ“„ thread_utils.h
    • ๐Ÿ“„ Makefile
    • ๐Ÿ“„ morse_converter

๐Ÿ“‹ Usage

Compilation in C

To compile the program, use the following command:

gcc -pthread -Wall src/main.cpp src/morse.cpp src/thread_utils.cpp -o morse_converter

Compilation in C++

To compile the program, use the following command:

g++ -pthread -Wall src/main.cpp src/morse.cpp src/thread_utils.cpp -o morse_converter

Compilation using Makefile

make

Execution

To run the program, use the following command:

./morse_converter

Command-line Arguments

  • -m2t <Morse code>: Convert Morse code to text.
  • -t2m <Text>: Convert text to Morse code.

Examples

Using Command-line Arguments

Convert Morse code to text:

./morse_converter -m2t "- .... ..."
Text: THS

Convert text to Morse code:

./morse_converter -t2m "THS"
Morse code: 
-
....
...

Without Command-line Arguments

./morse_converter
Choose an option:
1. Convert text to Morse code
2. Convert Morse code to text
Enter option (1 or 2): 1
Enter text to convert to Morse code: THS
Morse code: 
-
....
...
./morse_converter
Choose an option:
1. Convert text to Morse code
2. Convert Morse code to text
Enter option (1 or 2): 2
Enter Morse code to convert to text: - .... ...
Text: THS

Choose Custom Mapping Option

Project Image

../morse_converter A-.. B-.-. C..- D--.-Choose an option:
1. Convert text to Morse code
2. Convert Morse code to text
Enter option (1 or 2): 1
Enter text to convert to Morse code: ABC
Creating text-to-Morse thread...
Text-to-Morse thread created.
Thread entering semaphore...
Morse code: 
-..
-.-.
..-

Notes

  • Make sure to separate Morse code characters with spaces when providing input.

๐Ÿ‘จโ€๐Ÿ’ป Author

  • Paschalis M.

๐Ÿค Contributing

Contributions to improve the project are welcome! Please feel free to fork the repository, make changes, and submit a pull request.

๐Ÿ“œ License

This project is licensed under the MIT License.

  • License: MIT

morse-code-converter's People

Contributors

paschalis avatar

Stargazers

 avatar Katerina avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.