IZ3KLB

U arduino NANO, anche se “cinese dal costo di 2€ e un relè e il beacon è servito. Coinciso vero? Ho avuto dei problemi con il sito e lo sto rimettendo in piedi, con il tempo sistemerò anche questa paginetta. Intanlo la parte importante ce l’avete.

 

 

Buon lavoro de IZ3KLB Michele

 

A BREVE LE FOTO

Un BEACON con ARDUINO...

//

//Arduino Nano Beacon ver 1.1

// Written by Michele Casali Iz3klb

// Email: iz3klb@yahoo.it

//

// This code is so trivial that I'm releasing it completely without

// restrictions.  If you find it useful, it would be nice if you dropped

// me an email. Feel free to use whatever.

//

 

 

structt_mtab {charc, pat;};

 

structt_mtabmorsetab[] ={

  {'.', 106},

  {',', 115},

  {'?', 76},

  {'/', 41},

  {'A', 6},

  {'B', 17},

  {'C', 21},

  {'D', 9},

  {'E', 2},

  {'F', 20},

  {'G', 11},

  {'H', 16},

  {'I', 4},

  {'J', 30},

  {'K', 13},

  {'L', 18},

  {'M', 7},

  {'N', 5},

  {'O', 15},

  {'P', 22},

  {'Q', 27},

  {'R', 10},

  {'S', 8},

  {'T', 3},

  {'U', 12},

  {'V', 24},

  {'W', 14},

  {'X', 25},

  {'Y', 29},

  {'Z', 19},

  {'1', 62},

  {'2', 60},

  {'3', 56},

  {'4', 48},

  {'5', 32},

  {'6', 33},

  {'7', 35},

  {'8', 39},

  {'9', 47},

  {'0', 63}

} ;

 

#define N_MORSE ((sizeof(morsetab)/sizeof(morsetab[0]))

 

#define SPEED (12)

#define DOTLEN (1200/SPEED)

#define DASHLEN (3*(1200/SPEED))

#define UNDERSCORELEN  (75*(1200/SPEED)) //Timing for final line

intLEDpin=13 ;

 

void

underscoreDash()

{

digitalWrite(LEDpin, HIGH) ;

delay(UNDERSCORELEN);

digitalWrite(LEDpin, LOW) ;

delay(DOTLEN) ;

}

 

void

dash()

{

digitalWrite(LEDpin, HIGH) ;

delay(DASHLEN);

digitalWrite(LEDpin, LOW) ;

delay(DOTLEN) ;

}

 

void

dit()

{

digitalWrite(LEDpin, HIGH) ;

delay(DOTLEN);

digitalWrite(LEDpin, LOW) ;

delay(DOTLEN);

}

 

void

send(charc)

{

inti ;

if (c=='_') {

Serial.print(c) ;

underscoreDash() ;

return ;

  }

 

if (c==' ') {

Serial.print(c) ;

delay(7*DOTLEN) ;

return ;

  }

for (i=0; i<N_MORSE; i++) {

if (morsetab[i].c==c) {

unsignedcharp=morsetab[i].pat ;

Serial.print(morsetab[i].c) ;

 

while (p!=1) {

if (p&1)

dash() ;

else

dit() ;

p=p/2 ;

      }

delay(2*DOTLEN) ;

return ;

    }

  }

/* ifwedrop off the end, thenwesend a space */

Serial.print("?") ;

}

 

void

sendmsg(char*str)

{

while (*str)

send(*str++) ;

Serial.println("");

}

 

voidsetup() {

pinMode(LEDpin, OUTPUT) ;

Serial.begin(9600) ;

Serial.println("Simple Arduino Morse Beacon v1.1") ;

Serial.println("Written by Michele Casali <iz3klb@yahoo.it>") ;

Serial.println("Check out site @ http://www.iz3klb.it") ;

Serial.println("") ;

}

 

voidloop() {

sendmsg("VVV XX#XXX/B JN55TT PWR5W PSE QSL _") ;

delay(5000) ;

}