Arduino Nano: PTT VOX via Analog Mic

From OnnoWiki
Jump to navigation Jump to search
/*
  Rig PTT VOX
  Detect A0 dari Audio
  Output D5 ke Switch

  modified 2021 Dec 3
  by Onno W. Purbo
 */

int State=LOW;
int inPin=A0;
int outPin=5; 

void setup() {
  pinMode(outPin, OUTPUT);
}

void loop() {
  State=analogRead(inPin);
  if( State>30) digitalWrite(outPin, HIGH);
  else digitalWrite(outPin, LOW);
  delay(100);
}