Skip to content

soypat/morse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

morse

Morse code API. Communicate like it's 1830.

Example

Example using an LED with TinyGo:

//go:build tinygo

package main

import (
	"machine"
	"time"

	"github.com/soypat/morse"
)

// This is the hardware abstraction layer (HAL) for the telegraph's Pin.
func telegraphPinHAL(b bool) {
	machine.LED.Set(b)
}

func main() {
	machine.LED.Configure(machine.PinConfig{Mode: machine.PinOutput})
	telegraph := morse.NewTelegraph(100*time.Millisecond, telegraphPinHAL)
	for {
		println(`sending "HELLO WORLD"`)
		telegraph.Send("HELLO WORLD")
		time.Sleep(5 * time.Second)
	}
}