HamShield/examples/SSTV/SSTV.ino

67 lines
2.0 KiB
Arduino
Raw Permalink Normal View History

/* Hamshield
* Example: SSTV
* This program will transmit a test pattern. You will need
2016-08-14 02:25:46 +00:00
* SSTV equipment to test the output.
* Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading
2016-08-26 21:40:47 +00:00
* this program to your Arduino, open the Serial Monitor to
* view the status of the program. Tune your SSTV to
* 446MHz to receive the image output.
*/
2019-03-15 17:43:15 +00:00
#define MIC_PIN 3
2015-11-23 16:54:10 +00:00
#define RESET_PIN A3
#define SWITCH_PIN 2
#define DOT 100
#define CALLSIGN "1ZZ9ZZ/B"
/* Standard libraries and variable init */
2016-04-14 02:12:06 +00:00
#include <HamShield.h>
2016-04-14 02:12:06 +00:00
HamShield radio;
int16_t rssi;
/* get our radio ready */
2015-11-23 16:54:10 +00:00
void setup() {
// NOTE: if not using PWM out, it should be held low to avoid tx noise
2019-03-15 17:43:15 +00:00
pinMode(MIC_PIN, OUTPUT);
digitalWrite(MIC_PIN, LOW);
2015-11-23 16:54:10 +00:00
// prep the switch
pinMode(SWITCH_PIN, INPUT_PULLUP);
// set up the reset control pin
2019-12-23 16:14:37 +00:00
// NOTE: HamShieldMini doesn't have a reset pin, so this has no effect
2015-11-23 16:54:10 +00:00
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
delay(5); // wait for device to come up
2015-11-23 16:54:10 +00:00
Serial.begin(9600);
Serial.print("Radio status: ");
int result = radio.testConnection();
Serial.println(result);
radio.initialize();
2015-11-23 16:54:10 +00:00
radio.frequency(446000);
radio.setModeReceive();
}
/* main program loop */
void loop() {
2016-08-17 19:43:51 +00:00
if(radio.waitForChannel(1000,2000, -90)) { // Wait forever for calling frequency to open, then wait 2 seconds for breakers
radio.setModeTransmit(); // Turn on the transmitter
delay(250); // Wait a moment
radio.SSTVTestPattern(MARTIN1); // send a MARTIN1 test pattern
delay(250);
radio.setModeReceive(); // Turn off the transmitter
} else { delay(30000); } // someone broke in fast after prior transmission, was it an emergency? wait 30 secs.
delay(60000); // Wait a minute
}