Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rohanvashisht1234/morse
Morse Code library in Zig programming language
https://github.com/rohanvashisht1234/morse
morse morse-code morsecode morsecode-translator morsedecode
Last synced: 4 days ago
JSON representation
Morse Code library in Zig programming language
- Host: GitHub
- URL: https://github.com/rohanvashisht1234/morse
- Owner: RohanVashisht1234
- License: mit
- Created: 2024-02-28T19:17:57.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-28T20:46:09.000Z (10 months ago)
- Last Synced: 2024-10-31T03:08:43.097Z (about 2 months ago)
- Topics: morse, morse-code, morsecode, morsecode-translator, morsedecode
- Language: Zig
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# MORSE CODE LIBRARY FOR ZIG!!!
> Using this you can convert character to morse code and vice-verse.
## How to dry run:
Please run:
- `git clone https://github.com/RohanVashisht1234/morse.git`
- `zig build run_example`## How to use in your project:
Run the following in terminal:
- `$ mkdir my_morse`
- `$ cd my_morse`
- `$ zig init-exe`
Create a `build.zig.zon` file.- Enter the following:
```zon
.{
.name = "my_morse",
.version = "0.0.0",
.dependencies = .{
// morse v0.0.0
.morse = .{
.url = "https://github.com/RohanVashisht1234/morse/archive/refs/tags/morse.tar.gz",
.hash = "12202c6a33bb65f1f8d5c75631fa49b8f2b98f166df5576fc9729dc50888bb05f761",
}
}
}
```
Now, inside build.zig enter:
-
```zig
const morse = b.dependency("morse", .{
.target = target,
.optimize = optimize,
});
exe.addModule("morse", morse.module("morse"));
```
Now, inside main.zig add:```zig
const std = @import("std");
const morse = @import("morse");
const print = std.debug.print;pub fn main() !void {
try morse.init();
var character = morse.get_char_from_morse(".-");
print(".- is the morse code for: {s} \n", .{character});
var a_morse = morse.get_morse_from_char('A');
print("Morse code for a is: {s} \n", .{a_morse});
}```
- Run `zig build run`
- Enjoy morse coding ...# MADE BY: ROHAN VASHISHT