1 /*Copy the code below and up load it to the I/O Board
2 then put some kind of Antenna into PIN 8...PIN 8!!!!
3 Then tune to AM 1337kHz.
4 Optional:LED in pin 13 to see what is broadcasting,
5 also a protoshield to add multiple antenna's.
6 Lol that code will do morse code saying "I like ice cream";
7 *********THE CODE****************************************************
10 //WWW.JONNYBLANCH.WEBS.COM
11 long millisAtStart = 0;
14 const long period_broadcast = 8; //period of shortest broadcast (256 port changes)
17 //number of period_broadcasts in one 'dit',
18 //all other lengths are scaled from this
19 //Broadcasts on 1337 kHz
21 const int length_dit = LENGTH_DIT; //number of periods for dit
22 const int pause_dit = LENGTH_DIT; //pause after dit
23 const int length_dah = 3 * LENGTH_DIT; //number of persots for dah
24 const int pause_dah = LENGTH_DIT; //pause after dah
25 const int length_pause = 7 * LENGTH_DIT; //pause between words
30 void broadcast(int N_cycles);
31 void dontbroadcast(int N_cycles);
33 // ### INC ### Increment Register (reg = reg + 1)
34 #define ASM_INC(reg) asm volatile ("inc %0" : "=r" (reg) : "0" (reg))
39 DDRB = 0xFF; //Port B all outputs
40 //Do one dit to determine approximate frequency
41 millisAtStart = millis();
43 millisAtEnd = millis();
44 Serial.print(millisAtEnd - millisAtStart);
46 Serial.print((length_dit + pause_dit) * period_broadcast * 256 /
47 (millisAtEnd - millisAtStart) / 2);
101 for (int i = 0; i < length_dit; i++)
104 broadcast(period_broadcast);
108 for (int i = 0; i < pause_dit; i++)
111 dontbroadcast(period_broadcast);
118 for (int i = 0; i < length_dah; i++)
121 broadcast(period_broadcast);
125 for (int i = 0; i < pause_dah; i++)
128 dontbroadcast(period_broadcast);
135 for (int i = 0; i < length_pause; i++)
138 dontbroadcast(period_broadcast);
144 void broadcast(int N_cycles) {
145 unsigned int portvalue;
146 for (int i = 0; i < N_cycles; i++)
155 while (portvalue < 255);
159 void dontbroadcast(int N_cycles) {
160 unsigned int portvalue;
162 for (int i = 0; i < N_cycles; i++)
169 //add some assembly No OPerations to keep timing the same
170 asm volatile ("NOP");
172 while (portvalue < 255);