Starting to fill in the Telegraph/Morse project

cat-town
Dan Buch 10 years ago
parent b8a4054e6f
commit 3f19dbf392

@ -0,0 +1,5 @@
void setup() {
}
void loop() {
}

@ -0,0 +1,46 @@
// vim:filetype=arduino
#include <ctype.h>
#include <Arduino.h>
#include "telegraph.h"
const char* LETTERS[] = {
".-", // A
"-...", // B
"-.-.", // C
"-..", // D
".", // E
"..-.", // F
"--.", // G
"....", // H
"..", // I
".---", // J
"-.-", // K
".-..", // L
"--", // M
"-.", // N
"---", // O
".--.", // P
"--.-", // Q
".-.", // R
"...", // S
"-", // T
"..-", // U
"...-", // V
".--", // W
"-..-", // X
"-.--", // Y
"--.." // Z
};
const char* DIGITS[] = {
"-----", // 0
".----", // 1
"..---", // 2
"...--", // 3
"....-", // 4
".....", // 5
"-....", // 6
"--...", // 7
"---..", // 8
"----.", // 9
};

@ -0,0 +1,18 @@
#ifndef __TELEGRAPH_H__
#define __TELEGRAPH_H__
class Telegraph {
public:
Telegraph(const int output_pin, const int dit_length);
void send_message(const char* message);
private:
void dit();
void dah();
void output_code(const char* code);
void output_symbol(const int length);
int _output_pin;
int _dit_length;
int _dah_length;
};
#endif
Loading…
Cancel
Save