Code:
#define BASE 440
#define C0 1.0
#define D0 1.122
#define E0 1.26
#define FIS0 1.414
#define G0 1.498
#define A0 1.682
#define H0 1.888
#define C1 2*1.0
#define D1 2*1.122
#define FREQ(x) (F_CPU/(2*(x)-1))
#define TON(a,b,c) { FREQ(BASE*a), DAUER(b), PAUSE(c) }
#define DAUER(x) 12*x
#define PAUSE(x) 5*x
typedef struct
{
uint16_t freq;
uint8_t dauer;
uint8_t pause;
} ton_t;
const ton_t morse_ton[] PROGMEM =
{
TON (D0, 1, 1),
TON (D0, 1, 1),
TON (E0, 2, 1),
TON (D0, 2, 1),
TON (G0, 2, 1),
TON (FIS0, 4, 2),
TON (D0, 1, 1),
TON (D0, 1, 1),
TON (E0, 2, 1),
TON (D0, 2, 1),
TON (A0, 2, 1),
TON (G0, 4, 2),
TON (D0, 1, 1),
TON (D0, 1, 1),
TON (D1, 2, 1),
TON (H0, 2, 1),
TON (G0, 1, 1),
TON (G0, 1, 1),
TON (FIS0, 2, 1),
TON (E0, 2, 2),
TON (C1, 1, 1),
TON (C1, 1, 1),
TON (H0, 2, 1),
TON (G0, 2, 1),
TON (A0, 2, 1),
TON (G0, 4, 1),
{}
};
Lesezeichen