Resolve problems with examples not compiling or otherwise not functioning.
This commit is contained in:
		
							parent
							
								
									f369c2ff9a
								
							
						
					
					
						commit
						4f30789e88
					
				| 
						 | 
					@ -118,7 +118,7 @@ void loop() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  while(Serial.available()) {
 | 
					  while(Serial.available()) {
 | 
				
			||||||
    char c = Serial.read();
 | 
					    char c = Serial.read();
 | 
				
			||||||
    Serial.print(c);
 | 
					    Serial.println(c);
 | 
				
			||||||
    switch(c) {
 | 
					    switch(c) {
 | 
				
			||||||
      case 'h':
 | 
					      case 'h':
 | 
				
			||||||
        Serial.println(F("Commands:"));
 | 
					        Serial.println(F("Commands:"));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,13 +24,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HamShield radio;
 | 
					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() {
 | 
					void setup() {
 | 
				
			||||||
  // NOTE: if not using PWM out, it should be held low to avoid tx noise
 | 
					  // NOTE: if not using PWM out, it should be held low to avoid tx noise
 | 
				
			||||||
  pinMode(PWM_PIN, OUTPUT);
 | 
					  pinMode(PWM_PIN, OUTPUT);
 | 
				
			||||||
| 
						 | 
					@ -68,7 +61,6 @@ int txc = 0;
 | 
				
			||||||
int mode = 0;
 | 
					int mode = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void loop() {
 | 
					void loop() {
 | 
				
			||||||
   clr();
 | 
					 | 
				
			||||||
   int16_t rssi = radio.readRSSI();
 | 
					   int16_t rssi = radio.readRSSI();
 | 
				
			||||||
   gauge = map(rssi,-123,-50,0,8);
 | 
					   gauge = map(rssi,-123,-50,0,8);
 | 
				
			||||||
   Serial.print("[");
 | 
					   Serial.print("[");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,6 @@ void setup() {
 | 
				
			||||||
  Serial.println("Setting radio to its defaults..");
 | 
					  Serial.println("Setting radio to its defaults..");
 | 
				
			||||||
  radio.initialize();
 | 
					  radio.initialize();
 | 
				
			||||||
  radio.setRfPower(0);
 | 
					  radio.setRfPower(0);
 | 
				
			||||||
  //radio.setChanMode(3);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void loop() {
 | 
					void loop() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,16 +56,16 @@ void loop() {
 | 
				
			||||||
     if(x == -1) { 
 | 
					     if(x == -1) { 
 | 
				
			||||||
       for(x = 0; x < SIZE; x++) {
 | 
					       for(x = 0; x < SIZE; x++) {
 | 
				
			||||||
       if(mode == 4) { 
 | 
					       if(mode == 4) { 
 | 
				
			||||||
       sample1 = analogRead(0);
 | 
					       sample1 = analogRead(2);
 | 
				
			||||||
       sound[x] = sample1 >> 4;
 | 
					       sound[x] = sample1 >> 4;
 | 
				
			||||||
       delayMicroseconds(RATE); x++;
 | 
					       delayMicroseconds(RATE); x++;
 | 
				
			||||||
       sample1 = analogRead(0); 
 | 
					       sample1 = analogRead(2); 
 | 
				
			||||||
       sound[x] = (sample1 & 0xF0) | sound[x];
 | 
					       sound[x] = (sample1 & 0xF0) | sound[x];
 | 
				
			||||||
       delayMicroseconds(RATE);
 | 
					       delayMicroseconds(RATE);
 | 
				
			||||||
       } else {
 | 
					       } else {
 | 
				
			||||||
       sound[x] = analogRead(0);
 | 
					       sound[x] = analogRead(2);
 | 
				
			||||||
       delayMicroseconds(RATE); x++;
 | 
					       delayMicroseconds(RATE); x++;
 | 
				
			||||||
       sound[x] = analogRead(0);
 | 
					       sound[x] = analogRead(2);
 | 
				
			||||||
       delayMicroseconds(RATE);
 | 
					       delayMicroseconds(RATE);
 | 
				
			||||||
       }
 | 
					       }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,12 @@
 | 
				
			||||||
 * to your computer via USB. After uploading this program to 
 | 
					 * to your computer via USB. After uploading this program to 
 | 
				
			||||||
 * your adruino, open the Serial Monitor. Use the bar at the 
 | 
					 * your adruino, open the Serial Monitor. Use the bar at the 
 | 
				
			||||||
 * top of the serial monitor to enter commands as seen below.
 | 
					 * 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:
 | 
					Commands:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,14 +96,14 @@ void setup() {
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.begin(9600);
 | 
					  Serial.begin(9600);
 | 
				
			||||||
  Serial.print(";;;;;;;;;;;;;;;;;;;;;;;;;;");
 | 
					  Serial.println(";;;;;;;;;;;;;;;;;;;;;;;;;;");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int result = radio.testConnection();
 | 
					  int result = radio.testConnection();
 | 
				
			||||||
  Serial.print("*");
 | 
					  Serial.print("*");
 | 
				
			||||||
  Serial.print(result,DEC);
 | 
					  Serial.print(result,DEC);
 | 
				
			||||||
  Serial.print(";");
 | 
					  Serial.println(";");
 | 
				
			||||||
  radio.initialize(); // initializes automatically for UHF 12.5kHz channel
 | 
					  radio.initialize(); // initializes automatically for UHF 12.5kHz channel
 | 
				
			||||||
  Serial.print("*START;");  
 | 
					  Serial.println("*START;");  
 | 
				
			||||||
  radio.frequency(freq);
 | 
					  radio.frequency(freq);
 | 
				
			||||||
  radio.setVolume1(0xF);
 | 
					  radio.setVolume1(0xF);
 | 
				
			||||||
  radio.setVolume2(0xF);
 | 
					  radio.setVolume2(0xF);
 | 
				
			||||||
| 
						 | 
					@ -127,14 +133,14 @@ void loop() {
 | 
				
			||||||
               if(repeater == 1) { radio.frequency(tx); } 
 | 
					               if(repeater == 1) { radio.frequency(tx); } 
 | 
				
			||||||
               radio.setModeTransmit();
 | 
					               radio.setModeTransmit();
 | 
				
			||||||
               state = 10;
 | 
					               state = 10;
 | 
				
			||||||
               Serial.print("#TX,ON;");
 | 
					               Serial.println("#TX,ON;");
 | 
				
			||||||
               timer = millis();
 | 
					               timer = millis();
 | 
				
			||||||
               break;
 | 
					               break;
 | 
				
			||||||
           
 | 
					           
 | 
				
			||||||
           case 63: // ? - RSSI
 | 
					           case 63: // ? - RSSI
 | 
				
			||||||
               Serial.print(":");
 | 
					               Serial.print(":");
 | 
				
			||||||
               Serial.print(radio.readRSSI(),DEC);
 | 
					               Serial.print(radio.readRSSI(),DEC);
 | 
				
			||||||
               Serial.print(";");
 | 
					               Serial.println(";");
 | 
				
			||||||
               break;
 | 
					               break;
 | 
				
			||||||
             
 | 
					             
 | 
				
			||||||
           case 65: // A - CTCSS In
 | 
					           case 65: // A - CTCSS In
 | 
				
			||||||
| 
						 | 
					@ -155,7 +161,7 @@ void loop() {
 | 
				
			||||||
           case 70: // F - frequency
 | 
					           case 70: // F - frequency
 | 
				
			||||||
               getValue();
 | 
					               getValue();
 | 
				
			||||||
               freq = atol(cmdbuff);
 | 
					               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;
 | 
					               break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
           case 'M':
 | 
					           case 'M':
 | 
				
			||||||
| 
						 | 
					@ -194,14 +200,14 @@ void loop() {
 | 
				
			||||||
           case 94: // ^ - VSSI (voice) level
 | 
					           case 94: // ^ - VSSI (voice) level
 | 
				
			||||||
               Serial.print(":");
 | 
					               Serial.print(":");
 | 
				
			||||||
               Serial.print(radio.readVSSI(),DEC); 
 | 
					               Serial.print(radio.readVSSI(),DEC); 
 | 
				
			||||||
               Serial.print(";");
 | 
					               Serial.println(";");
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
      if(state == 10) { 
 | 
					      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()) { 
 | 
					     if(Serial.available()) { 
 | 
				
			||||||
        temp = Serial.read();
 | 
					        temp = Serial.read();
 | 
				
			||||||
        if(temp == 59) { cmdbuff[p] = 0; Serial.print("@");
 | 
					        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;
 | 
					         return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        cmdbuff[p] = temp;
 | 
					        cmdbuff[p] = temp;
 | 
				
			||||||
| 
						 | 
					@ -220,12 +227,12 @@ void getValue() {
 | 
				
			||||||
        if(p == 32) { 
 | 
					        if(p == 32) { 
 | 
				
			||||||
         Serial.print("@");
 | 
					         Serial.print("@");
 | 
				
			||||||
           for(int x = 0; x < 32; x++) { 
 | 
					           for(int x = 0; x < 32; x++) { 
 | 
				
			||||||
             Serial.print(cmdbuff[x]);
 | 
					             Serial.println(cmdbuff[x]);
 | 
				
			||||||
           } 
 | 
					           } 
 | 
				
			||||||
          
 | 
					          
 | 
				
			||||||
          cmdbuff[0] = 0; 
 | 
					          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
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
 * Example: Signal Test
 | 
					 * Example: Signal Test
 | 
				
			||||||
 * Plays back the current signal strength level and morses out 
 | 
					 * Plays back the current signal strength level and morses out 
 | 
				
			||||||
 * it's call sign at the end. You will need a HandyTalkie (HT)
 | 
					 * 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 
 | 
					 * Connect the HamShield to your Arduino. Screw the antenna 
 | 
				
			||||||
 * into the HamShield RF jack. Plug a pair of headphones into 
 | 
					 * into the HamShield RF jack. Plug a pair of headphones into 
 | 
				
			||||||
 * the HamShield. Connect the Arduino to wall power and then 
 | 
					 * the HamShield. Connect the Arduino to wall power and then 
 | 
				
			||||||
| 
						 | 
					@ -16,7 +17,7 @@
 | 
				
			||||||
*/ 
 | 
					*/ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DOT 100
 | 
					#define DOT 100
 | 
				
			||||||
#define CALLSIGN "1ZZ9ZZ/B"
 | 
					char CALLSIGN[] = "1ZZ9ZZ/B";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Standard libraries and variable init */
 | 
					/* Standard libraries and variable init */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue