added morse out to serial transceiver, fixed some library version issues
This commit is contained in:
		
							parent
							
								
									8ab7f97cbd
								
							
						
					
					
						commit
						e55cb9f221
					
				| 
						 | 
				
			
			@ -0,0 +1,119 @@
 | 
			
		|||
/* Serial glue to send messages over APRS 
 | 
			
		||||
 *  
 | 
			
		||||
 *  To do: add message receive code
 | 
			
		||||
 *  
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DDS_REFCLK_DEFAULT 9600
 | 
			
		||||
 | 
			
		||||
#include <HamShield.h>
 | 
			
		||||
#include <Wire.h>
 | 
			
		||||
#include <avr/wdt.h> 
 | 
			
		||||
 | 
			
		||||
HamShield radio;
 | 
			
		||||
DDS dds;
 | 
			
		||||
String messagebuff = "";
 | 
			
		||||
String origin_call = "";
 | 
			
		||||
String destination_call = "";
 | 
			
		||||
String textmessage = "";
 | 
			
		||||
int msgptr = 0;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(115200);
 | 
			
		||||
  Wire.begin();
 | 
			
		||||
  pinMode(2, OUTPUT);
 | 
			
		||||
  pinMode(3, OUTPUT);
 | 
			
		||||
  radio.initialize();
 | 
			
		||||
  radio.frequency(144390);
 | 
			
		||||
  radio.setRfPower(15);
 | 
			
		||||
  dds.start();
 | 
			
		||||
  radio.afsk.start(&dds);
 | 
			
		||||
  pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
 | 
			
		||||
  delay(100);
 | 
			
		||||
  Serial.println("HELLO");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
String temp[1] = "";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  messagebuff = "KC7IBT,KC7IBT,:HAMSHIELD TEST";
 | 
			
		||||
  prepMessage();
 | 
			
		||||
  delay(10000);
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
void prepMessage() { 
 | 
			
		||||
   radio.setModeTransmit();
 | 
			
		||||
   delay(500);
 | 
			
		||||
   origin_call = messagebuff.substring(0,messagebuff.indexOf(','));                                          // get originating callsign
 | 
			
		||||
   destination_call = messagebuff.substring(messagebuff.indexOf(',')+1,messagebuff.indexOf(',',messagebuff.indexOf(',')+1)); // get the destination call
 | 
			
		||||
   textmessage = messagebuff.substring(messagebuff.indexOf(":")+1);
 | 
			
		||||
   
 | 
			
		||||
   Serial.print("From: "); Serial.print(origin_call); Serial.print(" To: "); Serial.println(destination_call); Serial.println("Text: "); Serial.println(textmessage);
 | 
			
		||||
 | 
			
		||||
    AFSK::Packet *packet = AFSK::PacketBuffer::makePacket(22 + 32);
 | 
			
		||||
 | 
			
		||||
    packet->start();
 | 
			
		||||
    packet->appendCallsign(origin_call.c_str(),0);
 | 
			
		||||
    packet->appendCallsign(destination_call.c_str(),15,true);   
 | 
			
		||||
    packet->appendFCS(0x03);
 | 
			
		||||
    packet->appendFCS(0xf0);
 | 
			
		||||
    packet->print(textmessage);
 | 
			
		||||
    packet->finish();
 | 
			
		||||
 
 | 
			
		||||
    
 | 
			
		||||
    bool ret = radio.afsk.putTXPacket(packet);
 | 
			
		||||
 | 
			
		||||
    if(radio.afsk.txReady()) {
 | 
			
		||||
      Serial.println(F("txReady"));
 | 
			
		||||
      radio.setModeTransmit();
 | 
			
		||||
      //delay(100);
 | 
			
		||||
      if(radio.afsk.txStart()) {
 | 
			
		||||
        Serial.println(F("txStart"));
 | 
			
		||||
      } else {
 | 
			
		||||
        radio.setModeReceive();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // Wait 2 seconds before we send our beacon again.
 | 
			
		||||
    Serial.println("tick");
 | 
			
		||||
    // Wait up to 2.5 seconds to finish sending, and stop transmitter.
 | 
			
		||||
    // TODO: This is hackery.
 | 
			
		||||
    for(int i = 0; i < 500; i++) {
 | 
			
		||||
      if(radio.afsk.encoder.isDone())
 | 
			
		||||
         break;
 | 
			
		||||
      delay(50);
 | 
			
		||||
    }
 | 
			
		||||
    Serial.println("Done sending");
 | 
			
		||||
    delay(3000);
 | 
			
		||||
    radio.setModeReceive();
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
ISR(TIMER2_OVF_vect) {
 | 
			
		||||
  TIFR2 = _BV(TOV2);
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  if(++tcnt == 8) {
 | 
			
		||||
  digitalWrite(2, HIGH);
 | 
			
		||||
  dds.clockTick();
 | 
			
		||||
  digitalWrite(2, LOW);
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ISR(ADC_vect) {
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  TIFR1 = _BV(ICF1); // Clear the timer flag
 | 
			
		||||
  PORTD |= _BV(2); // Diagnostic pin (D2)
 | 
			
		||||
  dds.clockTick();
 | 
			
		||||
  if(++tcnt == 1) {
 | 
			
		||||
    if(radio.afsk.encoder.isSending()) {
 | 
			
		||||
      radio.afsk.timer();
 | 
			
		||||
    }
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
  PORTD &= ~(_BV(2)); // Pin D2 off again
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,126 @@
 | 
			
		|||
/* Serial glue to send messages over APRS 
 | 
			
		||||
 *  
 | 
			
		||||
 *  To do: add message receive code
 | 
			
		||||
 *  
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DDS_REFCLK_DEFAULT 9600
 | 
			
		||||
 | 
			
		||||
#include <HamShield.h>
 | 
			
		||||
#include <Wire.h>
 | 
			
		||||
#include <avr/wdt.h> 
 | 
			
		||||
 | 
			
		||||
HamShield radio;
 | 
			
		||||
DDS dds;
 | 
			
		||||
String messagebuff = "";
 | 
			
		||||
String origin_call = "";
 | 
			
		||||
String destination_call = "";
 | 
			
		||||
String textmessage = "";
 | 
			
		||||
int msgptr = 0;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(115200);
 | 
			
		||||
  Wire.begin();
 | 
			
		||||
  pinMode(2, OUTPUT);
 | 
			
		||||
  pinMode(3, OUTPUT);
 | 
			
		||||
  radio.initialize();
 | 
			
		||||
  radio.frequency(145570);
 | 
			
		||||
  radio.setRfPower(15);
 | 
			
		||||
  dds.start();
 | 
			
		||||
  radio.afsk.start(&dds);
 | 
			
		||||
  pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
 | 
			
		||||
  delay(100);
 | 
			
		||||
  Serial.println("HELLO");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
String temp[1] = "";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
    if(Serial.available()) { 
 | 
			
		||||
      char temp = (char)Serial.read();
 | 
			
		||||
      if(temp == '`') { 
 | 
			
		||||
       prepMessage(); msgptr = 0; Serial.print("!!"); } 
 | 
			
		||||
      else { 
 | 
			
		||||
        messagebuff += temp;
 | 
			
		||||
        msgptr++;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if(msgptr > 254) { messagebuff = ""; Serial.print("X!"); } 
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
void prepMessage() { 
 | 
			
		||||
   radio.setModeTransmit();
 | 
			
		||||
   delay(500);
 | 
			
		||||
   origin_call = messagebuff.substring(0,messagebuff.indexOf(','));        // get originating callsign
 | 
			
		||||
   destination_call = messagebuff.substring(messagebuff.indexOf(',')+1,
 | 
			
		||||
              messagebuff.indexOf(',',messagebuff.indexOf(',')+1)); // get the destination call
 | 
			
		||||
   textmessage = messagebuff.substring(messagebuff.indexOf(":"));
 | 
			
		||||
  
 | 
			
		||||
    AFSK::Packet *packet = AFSK::PacketBuffer::makePacket(22 + 32);
 | 
			
		||||
 | 
			
		||||
    packet->start();
 | 
			
		||||
    packet->appendCallsign(origin_call.c_str(),0);
 | 
			
		||||
    packet->appendCallsign(destination_call.c_str(),15,true);   
 | 
			
		||||
    packet->appendFCS(0x03);
 | 
			
		||||
    packet->appendFCS(0xf0);
 | 
			
		||||
    packet->print(textmessage);
 | 
			
		||||
    packet->finish();
 | 
			
		||||
 | 
			
		||||
    textmessage = "";
 | 
			
		||||
    
 | 
			
		||||
    bool ret = radio.afsk.putTXPacket(packet);
 | 
			
		||||
 | 
			
		||||
    if(radio.afsk.txReady()) {
 | 
			
		||||
      Serial.println(F("txReady"));
 | 
			
		||||
      radio.setModeTransmit();
 | 
			
		||||
      //delay(100);
 | 
			
		||||
      if(radio.afsk.txStart()) {
 | 
			
		||||
        Serial.println(F("txStart"));
 | 
			
		||||
      } else {
 | 
			
		||||
        radio.setModeReceive();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // Wait 2 seconds before we send our beacon again.
 | 
			
		||||
    Serial.println("tick");
 | 
			
		||||
    // Wait up to 2.5 seconds to finish sending, and stop transmitter.
 | 
			
		||||
    // TODO: This is hackery.
 | 
			
		||||
    for(int i = 0; i < 500; i++) {
 | 
			
		||||
      if(radio.afsk.encoder.isDone())
 | 
			
		||||
         break;
 | 
			
		||||
      delay(50);
 | 
			
		||||
    }
 | 
			
		||||
    Serial.println("Done sending");
 | 
			
		||||
    delay(3000);
 | 
			
		||||
    radio.setModeReceive();
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
ISR(TIMER2_OVF_vect) {
 | 
			
		||||
  TIFR2 = _BV(TOV2);
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  if(++tcnt == 8) {
 | 
			
		||||
  digitalWrite(2, HIGH);
 | 
			
		||||
  dds.clockTick();
 | 
			
		||||
  digitalWrite(2, LOW);
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ISR(ADC_vect) {
 | 
			
		||||
  static uint8_t tcnt = 0;
 | 
			
		||||
  TIFR1 = _BV(ICF1); // Clear the timer flag
 | 
			
		||||
  PORTD |= _BV(2); // Diagnostic pin (D2)
 | 
			
		||||
  dds.clockTick();
 | 
			
		||||
  if(++tcnt == 1) {
 | 
			
		||||
    if(radio.afsk.encoder.isSending()) {
 | 
			
		||||
      radio.afsk.timer();
 | 
			
		||||
    }
 | 
			
		||||
    tcnt = 0;
 | 
			
		||||
  }
 | 
			
		||||
  PORTD &= ~(_BV(2)); // Pin D2 off again
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
chrome.app.runtime.onLaunched.addListener(function() {
 | 
			
		||||
  chrome.app.window.create("window.html", {
 | 
			
		||||
    "bounds": {
 | 
			
		||||
        "width": 685,
 | 
			
		||||
        "height": 800
 | 
			
		||||
    }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
  $(function() {
 | 
			
		||||
    $( "#tabs" ).tabs();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 11 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 11 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 11 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 11 KiB  | 
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{
 | 
			
		||||
  "name": "HamShield",
 | 
			
		||||
  "description": "HamShield",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "app": {
 | 
			
		||||
    "background": {
 | 
			
		||||
        "scripts": ["background.js"]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
chromeApp
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
body{
 | 
			
		||||
  display: inline-block;  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btn {
 | 
			
		||||
  background: #adadad;
 | 
			
		||||
  background-image: -webkit-linear-gradient(top, #adadad, #3d3d3d);
 | 
			
		||||
  background-image: -moz-linear-gradient(top, #adadad, #3d3d3d);
 | 
			
		||||
  background-image: -ms-linear-gradient(top, #adadad, #3d3d3d);
 | 
			
		||||
  background-image: -o-linear-gradient(top, #adadad, #3d3d3d);
 | 
			
		||||
  background-image: linear-gradient(to bottom, #adadad, #3d3d3d);
 | 
			
		||||
  -webkit-border-radius: 0;
 | 
			
		||||
  -moz-border-radius: 0;
 | 
			
		||||
  border-radius: 0px;
 | 
			
		||||
  font-family: Arial;
 | 
			
		||||
  color: #ffffff;
 | 
			
		||||
  font-size: 20px;
 | 
			
		||||
  padding: 10px 20px 10px 20px;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
  float: left;
 | 
			
		||||
  text-align:center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btn:hover {
 | 
			
		||||
  background: #3d3d3d;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.lcd {
 | 
			
		||||
  -webkit-border-radius: 0;
 | 
			
		||||
  -moz-border-radius: 0;
 | 
			
		||||
  border-radius: 0px;
 | 
			
		||||
  font-family: Courier New;
 | 
			
		||||
  color: #00ff00;
 | 
			
		||||
  font-size: 50px;
 | 
			
		||||
  background: #000000;
 | 
			
		||||
  padding: 10px 20px 10px 20px;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
  width: 500px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.lcd:hover {
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.bs1 { width: 50px; }
 | 
			
		||||
.bs2 { width: 100px; }
 | 
			
		||||
.bs3 { width: 200px; }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <link rel="stylesheet" type="text/css" href="styles.css">
 | 
			
		||||
  <meta charset="utf-8">
 | 
			
		||||
  <title>APRSMessenger</title>
 | 
			
		||||
  <link rel="stylesheet" href="jquery-ui.css">
 | 
			
		||||
  <script src="jquery-1.10.2.js"></script>
 | 
			
		||||
  <script src="jquery-ui.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <div class="lcd" style="width: 768px">
 | 
			
		||||
       144.390 MHz | APRS | <img src="bars-3.png" style="height: 32px; width: 32px;">
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="lcd" style="width: 768px; font-size: 15px;">
 | 
			
		||||
      2M | BW: 25KHz | TX CTCSS: OFF | RX CTCSS: OFF | Filter: OFF | Presence: Available 
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn" style="width: 75px">
 | 
			
		||||
       Tune
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
       Presence
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      GPS
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      SSTV
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      WX
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      MSG
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      SQ-
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      SQ+
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="btn">
 | 
			
		||||
      VOL
 | 
			
		||||
    </div>
 | 
			
		||||
    <br/><br/>
 | 
			
		||||
    <div id="tabs">
 | 
			
		||||
     <ul>
 | 
			
		||||
       <li><a href="#tabs-1">Console</a></li>
 | 
			
		||||
       <li><a href="#tabs-2">KG7OGM</a></li>
 | 
			
		||||
       <li><a href="#tabs-3">KC7IBT</a></li>
 | 
			
		||||
     </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="tabs-1">
 | 
			
		||||
      Debug messages
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="tabs-2">
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="tabs-3">
 | 
			
		||||
    </div>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -30,16 +30,17 @@ void setup() {
 | 
			
		|||
  
 | 
			
		||||
  // Tell the HamShield to start up
 | 
			
		||||
  radio.initialize();
 | 
			
		||||
  
 | 
			
		||||
  radio.setRfPower(15);
 | 
			
		||||
  // Configure the HamShield to transmit and recieve on 446.000MHz
 | 
			
		||||
  radio.frequency(446000);
 | 
			
		||||
  radio.frequency(145570);
 | 
			
		||||
  pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
 | 
			
		||||
  
 | 
			
		||||
  Serial.println("Radio Configured.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  // We'll wait up to 30 seconds for a clear channel, requiring that the channel is clear for 2 seconds before we transmit
 | 
			
		||||
  if (radio.waitForChannel(30000,2000,-50)) {
 | 
			
		||||
  if (radio.waitForChannel(30000,2000,-5)) {
 | 
			
		||||
    // If we get here, the channel is clear. Let's print the RSSI to the serial port as well.
 | 
			
		||||
    Serial.print("Signal is clear, RSSI: ");
 | 
			
		||||
    Serial.println(radio.readRSSI());
 | 
			
		||||
| 
						 | 
				
			
			@ -49,14 +50,14 @@ void loop() {
 | 
			
		|||
    radio.setModeTransmit();
 | 
			
		||||
    
 | 
			
		||||
    // Send a message out in morse code
 | 
			
		||||
    radio.morseOut("CALLSIGN LOCATOR ARDUINO HAMSHIELD");
 | 
			
		||||
    radio.morseOut("KC7IBT ARDUINO HAMSHIELD");
 | 
			
		||||
    
 | 
			
		||||
    // We're done sending the message, set the radio back into recieve mode.
 | 
			
		||||
    radio.setModeReceive();
 | 
			
		||||
    Serial.println("Done.");
 | 
			
		||||
    
 | 
			
		||||
    // Wait 30 seconds before we send our beacon again.
 | 
			
		||||
    delay(30000);    
 | 
			
		||||
    delay(1000);    
 | 
			
		||||
  } else {
 | 
			
		||||
    // If we get here, the channel is busy. Let's also print out the RSSI.
 | 
			
		||||
    Serial.print("The channel was busy. Waiting 10 seconds. RSSI: ");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
/* HamShield Functional Test */
 | 
			
		||||
 | 
			
		||||
#include <HamShield.h>
 | 
			
		||||
#include <Wire.h>
 | 
			
		||||
 | 
			
		||||
HamShield radio;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Wire.begin();
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
			
		||||
  Serial.print("Radio status: ");
 | 
			
		||||
  int result = radio.testConnection();
 | 
			
		||||
  Serial.println(result,DEC);
 | 
			
		||||
  Serial.println("Setting radio to its defaults..");
 | 
			
		||||
  radio.initialize();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  radio.setModeReceive();
 | 
			
		||||
  radio.setSQLoThresh(0);
 | 
			
		||||
  radio.setSQOn();
 | 
			
		||||
  radio.setVolume1(0xF);
 | 
			
		||||
  radio.setVolume2(0xF);
 | 
			
		||||
  delay(1000);
 | 
			
		||||
  Serial.println("Changing frequency to 446.000 and waiting 10 seconds. You should hear static fading in.");
 | 
			
		||||
    radio.frequency(446000);
 | 
			
		||||
  for(int x = 0; x < 16; x++) { radio.setVolume1(x); delay(500); Serial.print(x); Serial.print(".."); } 
 | 
			
		||||
  for(int x = 0; x < 16; x++) { radio.setVolume2(x); delay(500); Serial.print(x); Serial.print(".."); }   
 | 
			
		||||
      radio.setVolume1(0xF);
 | 
			
		||||
    radio.setVolume2(0xF);
 | 
			
		||||
 | 
			
		||||
  delay(10000);
 | 
			
		||||
  Serial.println("Changing frequency to 450.000 and waiting 10 seconds. You should hear static.");
 | 
			
		||||
  radio.frequency(446000);
 | 
			
		||||
  delay(10000);
 | 
			
		||||
  Serial.println("Changing frequency to 220.000 and waiting 10 seconds. you should hear static.");
 | 
			
		||||
  radio.frequency(220000);
 | 
			
		||||
  delay(10000);
 | 
			
		||||
  Serial.println("Changing frequency to 144.520 and waiting 10 seconds. you should hear static.");
 | 
			
		||||
  radio.frequency(144520);
 | 
			
		||||
  delay(10000);
 | 
			
		||||
  Serial.println("Now lets scan for a weather radio station and listen for a while....");
 | 
			
		||||
  radio.setWXChannel(radio.scanWXChannel());
 | 
			
		||||
  Serial.println("If you hear weather radio, it means the scanWXChannel() and setWXChannel() and VHF works.");
 | 
			
		||||
  Serial.println("We will sit here for 30 seconds because weather is important.");
 | 
			
		||||
  delay(30000);
 | 
			
		||||
  Serial.println("We will now tune to 446.000 and send morse code");
 | 
			
		||||
  radio.frequency(446000);
 | 
			
		||||
  radio.setModeTransmit();
 | 
			
		||||
  radio.morseOut("HELLO PERSON");
 | 
			
		||||
  radio.setModeReceive();
 | 
			
		||||
  Serial.println("Now we are receiving on the call frequency. Starting over again.");
 | 
			
		||||
 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
/* Just Transmit */
 | 
			
		||||
 | 
			
		||||
#include <HamShield.h>
 | 
			
		||||
#include <Wire.h>
 | 
			
		||||
 | 
			
		||||
HamShield radio;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Wire.begin();
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
 | 
			
		||||
  Serial.print("Radio status: ");
 | 
			
		||||
  int result = radio.testConnection();
 | 
			
		||||
  Serial.println(result,DEC);
 | 
			
		||||
  Serial.println("Setting radio to its defaults..");
 | 
			
		||||
  radio.initialize();
 | 
			
		||||
  radio.setRfPower(15);
 | 
			
		||||
  radio.setChanMode(3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  radio.bypassPreDeEmph();
 | 
			
		||||
  radio.frequency(144000);
 | 
			
		||||
  // radio.setTxSourceNone();
 | 
			
		||||
  radio.setModeTransmit();
 | 
			
		||||
  for(;;) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +17,7 @@ Frequency      F<freq>;    Set the receive frequency in KHz, if offset is disabl
 | 
			
		|||
CDCSS In       G<code>;    <code> must be a valid CDCSS code                                                                                                            No
 | 
			
		||||
CDCSS Out      H<code>;    <code> must be a valid CDCSS code                                                                                                            No
 | 
			
		||||
Print tones    I           Prints out all configured tones and codes, coma delimited in format: CTCSS In, CTCSS Out, CDCSS In, CDCSS Out                                No
 | 
			
		||||
Morse Out      M<text>;    A small buffer for morse code (32 chars)
 | 
			
		||||
Power level    P<level>;   Set the power amp level, 0 = lowest, 15 = highest                                                                                           No
 | 
			
		||||
Enable Offset  R<state>;   1 turns on repeater offset mode, 0 turns off repeater offset mode                                                                            No
 | 
			
		||||
Squelch        S<level>;   Set the squelch level                                                                                                                        No
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,7 @@ Debug Msg    @<text>;   32 character debug message
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
#include "Wire.h"
 | 
			
		||||
#include "HAMShield.h"
 | 
			
		||||
#include "HamShield.h"
 | 
			
		||||
 | 
			
		||||
int state;
 | 
			
		||||
int txcount = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +63,7 @@ int cdcssin = 0;
 | 
			
		|||
int cdcssout = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
HAMShield radio;
 | 
			
		||||
HamShield radio;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +137,14 @@ void loop() {
 | 
			
		|||
               freq = atol(cmdbuff);
 | 
			
		||||
               if(radio.frequency(freq) == true) { Serial.print("@"); Serial.print(freq,DEC); Serial.print(";!;"); } else { Serial.print("X1;"); } 
 | 
			
		||||
               break;
 | 
			
		||||
 | 
			
		||||
           case 'M':
 | 
			
		||||
               getValue();
 | 
			
		||||
               radio.setModeTransmit();
 | 
			
		||||
               delay(300);
 | 
			
		||||
               radio.morseOut(cmdbuff);
 | 
			
		||||
               state = 10;
 | 
			
		||||
               break; 
 | 
			
		||||
               
 | 
			
		||||
           case 80: // P - power level
 | 
			
		||||
               getValue();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue