This is the code for my simplex "parrot" repeater, based on a voice module "ISD 1820", a "DRA818U" transceiver module and an "Arduino" controler.
[code]
int PTT = 13;
int REC = 2;
int PLAY = 8;
int PTTLED = 11;
int RECLED = 10;
const int SQ = 6;
long startTime;
long duration;
void setup()
{
pinMode(PTT, OUTPUT);
digitalWrite(PTT, HIGH); //pullUp
pinMode(REC, OUTPUT);
pinMode(PLAY, OUTPUT);
pinMode(PTTLED, OUTPUT);
pinMode(RECLED, OUTPUT);
pinMode(SQ, INPUT);
digitalWrite(SQ, HIGH); //pullUp
}
void loop()
{
if(digitalRead(SQ) == HIGH)
{digitalWrite(REC, LOW);
digitalWrite(RECLED, LOW);
digitalWrite(PLAY, LOW);
delay (25);}
if(digitalRead(SQ) == LOW)
{digitalWrite(REC, HIGH);
digitalWrite(RECLED, HIGH);}
if(digitalRead(SQ) == LOW)
{
startTime = millis();
while(digitalRead(SQ) == LOW);
long duration = millis() - startTime;
digitalWrite(REC, LOW);
digitalWrite(RECLED, LOW);
delay (25);
digitalWrite (PTT, LOW);
digitalWrite(PTTLED, HIGH);
delay (500);
digitalWrite(PLAY, HIGH);
delay (100);
digitalWrite(PLAY, LOW);
delay (duration);
digitalWrite (PTT, HIGH);
digitalWrite(PTTLED, LOW);
}
}
[/code]
Code by IN3RAY