int radioPin = 4 ; // Optocoupleur émission int audioPin = 12 ; // HP de contrôle (facultatif) int ToneFreq = 980 ; typedef struct glyph { char ch ; word col[7] ; } Glyph ; const Glyph glyphtab[] PROGMEM = { {' ', {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}}, {'A', {0x07fc, 0x0e60, 0x0c60, 0x0e60, 0x07fc, 0x0000, 0x0000}}, {'B', {0x0c0c, 0x0ffc, 0x0ccc, 0x0ccc, 0x0738, 0x0000, 0x0000}}, {'C', {0x0ffc, 0x0c0c, 0x0c0c, 0x0c0c, 0x0e1c, 0x0000, 0x0000}}, {'D', {0x0c0c, 0x0ffc, 0x0c0c, 0x0c0c, 0x07f8, 0x0000, 0x0000}}, {'E', {0x0ffc, 0x0ccc, 0x0ccc, 0x0c0c, 0x0c0c, 0x0000, 0x0000}}, {'F', {0x0ffc, 0x0cc0, 0x0cc0, 0x0c00, 0x0c00, 0x0000, 0x0000}}, {'G', {0x0ffc, 0x0c0c, 0x0c0c, 0x0ccc, 0x0cfc, 0x0000, 0x0000}}, {'H', {0x0ffc, 0x00c0, 0x00c0, 0x00c0, 0x0ffc, 0x0000, 0x0000}}, {'I', {0x0000, 0x0c0c, 0x0ffc, 0x0c0c, 0x0000, 0x0000, 0x0000}}, {'J', {0x003c, 0x000c, 0x000c, 0x000c, 0x0ffc, 0x0000, 0x0000}}, {'K', {0x0ffc, 0x00c0, 0x01e0, 0x0330, 0x0e1c, 0x0000, 0x0000}}, {'L', {0x0ffc, 0x000c, 0x000c, 0x000c, 0x000c, 0x0000, 0x0000}}, {'M', {0x0ffc, 0x0600, 0x0300, 0x0600, 0x0ffc, 0x0000, 0x0000}}, {'N', {0x0ffc, 0x0700, 0x01c0, 0x0070, 0x0ffc, 0x0000, 0x0000}}, {'O', {0x0ffc, 0x0c0c, 0x0c0c, 0x0c0c, 0x0ffc, 0x0000, 0x0000}}, {'P', {0x0c0c, 0x0ffc, 0x0ccc, 0x0cc0, 0x0fc0, 0x0000, 0x0000}}, {'Q', {0x07f8, 0x0c0c, 0x0c0c, 0x07fc, 0x0007, 0x0000, 0x0000}}, {'R', {0x0ffc, 0x0cc0, 0x0cc0, 0x0cf0, 0x079c, 0x0000, 0x0000}}, {'S', {0x078c, 0x0ccc, 0x0ccc, 0x0ccc, 0x0c78, 0x0000, 0x0000}}, {'T', {0x0c00, 0x0c00, 0x0ffc, 0x0c00, 0x0c00, 0x0000, 0x0000}}, {'U', {0x0ffc, 0x000c, 0x000c, 0x000c, 0x0ffc, 0x0000, 0x0000}}, {'V', {0x0ffc, 0x0018, 0x0078, 0x01c0, 0x0f00, 0x0000, 0x0000}}, {'W', {0x0ff8, 0x000c, 0x007c, 0x000c, 0x0ff8, 0x0000, 0x0000}}, {'X', {0x0c0c, 0x0738, 0x01e0, 0x0738, 0x0c0c, 0x0000, 0x0000}}, {'Y', {0x0e00, 0x0384, 0x00fc, 0x0384, 0x0e00, 0x0000, 0x0000}}, {'Z', {0x0c3c, 0x0c6c, 0x0ccc, 0x0d8c, 0x0f0c, 0x0000, 0x0000}}, {'0', {0x07f8, 0x0c0c, 0x0c0c, 0x0c0c, 0x07f8, 0x0000, 0x0000}}, {'1', {0x0180, 0x0300, 0x0604, 0x0ffc, 0x0004, 0x0000, 0x0000}}, {'2', {0x061c, 0x0c3c, 0x0c6c, 0x0ccc, 0x078c, 0x0000, 0x0000}}, {'3', {0x0c03, 0x0c03, 0x0cc6, 0x0fcc, 0x0078, 0x0000, 0x0000}}, {'4', {0x1fe0, 0x00c0, 0x00c0, 0x0ffc, 0x00c0, 0x0000, 0x0000}}, {'5', {0x0003, 0x1fc3, 0x18c6, 0x18cc, 0x1878, 0x0000, 0x0000}}, {'6', {0x07fc, 0x0c46, 0x18c6, 0x00c6, 0x007c, 0x0000, 0x0000}}, {'7', {0x0e06, 0x0c1c, 0x0c70, 0x0cc0, 0x0f80, 0x0000, 0x0000}}, {'8', {0x0f3c, 0x19e6, 0x18c6, 0x19e6, 0x0f3c, 0x0000, 0x0000}}, {'9', {0x0786, 0x0cc6, 0x0c4c, 0x0c58, 0x07f0, 0x0000, 0x0000}}, {'?', {0x0c00, 0x1800, 0x18e6, 0x1980, 0x0f00, 0x0000, 0x0000}}, {'/', {0x001c, 0x0070, 0x01c0, 0x0700, 0x1c00, 0x0000, 0x0000}}, {'-', {0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000}}, {'+', {0x0180, 0x0180, 0x0ff0, 0x0180, 0x0180, 0x0000, 0x0000}}, } ; #define NGLYPHS (sizeof(glyphtab)/sizeof(glyphtab[0])) void encodechar(int ch) { int i, x, y, fch ; word fbits ; for (i = 0; i < NGLYPHS; i++) { fch = pgm_read_byte(&glyphtab[i].ch) ; if (fch == ch) { for (x = 0; x < 7; x++) { fbits = pgm_read_word(&(glyphtab[i].col[x])) ; for (y = 0; y < 14; y++) { if (fbits & (1 << y)) { digitalWrite(radioPin, HIGH) ; tone(audioPin, ToneFreq) ; } else { digitalWrite(radioPin, LOW) ; noTone(audioPin) ; } //delayMicroseconds(4045L) ; delayMicroseconds(3995L) ; } } } } } void encode(char *ch) { while (*ch != '\0') encodechar(*ch++) ; } void setup() { pinMode(radioPin, OUTPUT) ; pinMode(audioPin, OUTPUT) ; } void loop() { encode("ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 +-/? ") ; }