Resolve problems with examples not compiling or otherwise not functioning.

This commit is contained in:
nick6x 2016-08-22 01:40:27 -07:00
parent f369c2ff9a
commit 4f30789e88
6 changed files with 26 additions and 27 deletions

View File

@ -118,7 +118,7 @@ void loop() {
}
while(Serial.available()) {
char c = Serial.read();
Serial.print(c);
Serial.println(c);
switch(c) {
case 'h':
Serial.println(F("Commands:"));

View File

@ -24,13 +24,6 @@
HamShield radio;
void clr() {
/* Serial.write(27);
Serial.print("[2J"); // cursor to home command */
Serial.write(27);
Serial.print("[H"); // cursor to home command
}
void setup() {
// NOTE: if not using PWM out, it should be held low to avoid tx noise
pinMode(PWM_PIN, OUTPUT);
@ -68,7 +61,6 @@ int txc = 0;
int mode = 0;
void loop() {
clr();
int16_t rssi = radio.readRSSI();
gauge = map(rssi,-123,-50,0,8);
Serial.print("[");

View File

@ -39,7 +39,6 @@ void setup() {
Serial.println("Setting radio to its defaults..");
radio.initialize();
radio.setRfPower(0);
//radio.setChanMode(3);
}
void loop() {

View File

@ -56,16 +56,16 @@ void loop() {
if(x == -1) {
for(x = 0; x < SIZE; x++) {
if(mode == 4) {
sample1 = analogRead(0);
sample1 = analogRead(2);
sound[x] = sample1 >> 4;
delayMicroseconds(RATE); x++;
sample1 = analogRead(0);
sample1 = analogRead(2);
sound[x] = (sample1 & 0xF0) | sound[x];
delayMicroseconds(RATE);
} else {
sound[x] = analogRead(0);
sound[x] = analogRead(2);
delayMicroseconds(RATE); x++;
sound[x] = analogRead(0);
sound[x] = analogRead(2);
delayMicroseconds(RATE);
}
}

View File

@ -8,6 +8,12 @@
* to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. Use the bar at the
* top of the serial monitor to enter commands as seen below.
*
* EXAMPLE: To change the repeater offset to 144.425MHz,
* enable offset, then key in, use the following commands:
* T144425;
* R1;
* [Just a space]
Commands:
@ -90,14 +96,14 @@ void setup() {
digitalWrite(RESET_PIN, HIGH);
Serial.begin(9600);
Serial.print(";;;;;;;;;;;;;;;;;;;;;;;;;;");
Serial.println(";;;;;;;;;;;;;;;;;;;;;;;;;;");
int result = radio.testConnection();
Serial.print("*");
Serial.print(result,DEC);
Serial.print(";");
Serial.println(";");
radio.initialize(); // initializes automatically for UHF 12.5kHz channel
Serial.print("*START;");
Serial.println("*START;");
radio.frequency(freq);
radio.setVolume1(0xF);
radio.setVolume2(0xF);
@ -127,14 +133,14 @@ void loop() {
if(repeater == 1) { radio.frequency(tx); }
radio.setModeTransmit();
state = 10;
Serial.print("#TX,ON;");
Serial.println("#TX,ON;");
timer = millis();
break;
case 63: // ? - RSSI
Serial.print(":");
Serial.print(radio.readRSSI(),DEC);
Serial.print(";");
Serial.println(";");
break;
case 65: // A - CTCSS In
@ -155,7 +161,7 @@ void loop() {
case 70: // F - frequency
getValue();
freq = atol(cmdbuff);
if(radio.frequency(freq) == true) { Serial.print("@"); Serial.print(freq,DEC); Serial.print(";!;"); } else { Serial.print("X1;"); }
if(radio.frequency(freq) == true) { Serial.print("@"); Serial.print(freq,DEC); Serial.println(";!;"); } else { Serial.println("X1;"); }
break;
case 'M':
@ -194,14 +200,14 @@ void loop() {
case 94: // ^ - VSSI (voice) level
Serial.print(":");
Serial.print(radio.readVSSI(),DEC);
Serial.print(";");
Serial.println(";");
}
break;
}
}
if(state == 10) {
if(millis() > (timer + 500)) { Serial.print("#TX,OFF;");radio.setModeReceive(); if(repeater == 1) { radio.frequency(freq); } state = 0; txcount = 0; }
if(millis() > (timer + 500)) { Serial.println("#TX,OFF;");radio.setModeReceive(); if(repeater == 1) { radio.frequency(freq); } state = 0; txcount = 0; }
}
}
@ -212,7 +218,8 @@ void getValue() {
if(Serial.available()) {
temp = Serial.read();
if(temp == 59) { cmdbuff[p] = 0; Serial.print("@");
for(int x = 0; x < 32; x++) { Serial.print(cmdbuff[x]); }
for(int x = 0; x < 32; x++) { Serial.print(cmdbuff[x]);}
Serial.println();
return;
}
cmdbuff[p] = temp;
@ -220,12 +227,12 @@ void getValue() {
if(p == 32) {
Serial.print("@");
for(int x = 0; x < 32; x++) {
Serial.print(cmdbuff[x]);
Serial.println(cmdbuff[x]);
}
cmdbuff[0] = 0;
Serial.print("X0;"); return; } // some sort of alignment issue? lets not feed junk into whatever takes this string in
Serial.println("X0;"); return; } // some sort of alignment issue? lets not feed junk into whatever takes this string in
}
}
}

View File

@ -2,7 +2,8 @@
* Example: Signal Test
* Plays back the current signal strength level and morses out
* it's call sign at the end. You will need a HandyTalkie (HT)
* to test the output of this example.
* to test the output of this example. You also need to
* download the PCM library.
* Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then
@ -16,7 +17,7 @@
*/
#define DOT 100
#define CALLSIGN "1ZZ9ZZ/B"
char CALLSIGN[] = "1ZZ9ZZ/B";
/* Standard libraries and variable init */