Difference between revisions of "Arduino Nano: PPT VOX"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " →‎Rig PTT VOX Detect D4 dari Audio Output D3 ke Switch modified 2021 Dec 3 by Onno W. Purbo: int State=LOW; int inPin=4; int outPin=3; // the...")
 
Line 1: Line 1:
 +
 +
/*
 +
  Rig PTT VOX
 +
  Detect D4 dari Audio
 +
  Output D3 ke Switch
 +
 +
  modified 2021 Dec 3
 +
  by Onno W. Purbo
 +
  */
 +
 +
boolean State=LOW;
 +
int inPin=4;
 +
int outPin=3;
 +
 +
// the setup function runs once when you press reset or power the board
 +
void setup() {
 +
  // initialize digital pin 3 as an output.
 +
  pinMode(outPin, OUTPUT);
 +
  pinMode(inPin, INPUT);
 +
}
 +
 +
// the loop function runs over and over again forever
 +
void loop() {
 +
  State=digitalRead(inPin);
 +
  digitalWrite(outPin, !State);
 +
  delay(10);
 +
}
 +
 +
 +
 +
==Alternatif Lain==
 +
  
 
  /*
 
  /*
Line 23: Line 55:
 
  void loop() {
 
  void loop() {
 
   State=digitalRead(inPin);
 
   State=digitalRead(inPin);
   digitalWrite(outPin, State);
+
   if( State==1 )
 +
      digitalWrite(outPin, LOW );
 +
  else
 +
      digitalWrite(outPin, HIGH );
 
   delay(10);
 
   delay(10);
 
  }
 
  }

Revision as of 18:36, 4 December 2021

/*
  Rig PTT VOX
  Detect D4 dari Audio
  Output D3 ke Switch

  modified 2021 Dec 3
  by Onno W. Purbo
 */

boolean State=LOW;
int inPin=4;
int outPin=3; 

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 3 as an output.
  pinMode(outPin, OUTPUT);
  pinMode(inPin, INPUT);
}

// the loop function runs over and over again forever
void loop() {
  State=digitalRead(inPin);
  digitalWrite(outPin, !State);
  delay(10);
}


Alternatif Lain

/*
  Rig PTT VOX
  Detect D4 dari Audio
  Output D3 ke Switch

  modified 2021 Dec 3
  by Onno W. Purbo
 */

int State=LOW;
int inPin=4;
int outPin=3; 

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 3 as an output.
  pinMode(outPin, OUTPUT);
  pinMode(inPin, INPUT);
}

// the loop function runs over and over again forever
void loop() {
  State=digitalRead(inPin);
  if( State==1 )
     digitalWrite(outPin, LOW );
  else
     digitalWrite(outPin, HIGH );
  delay(10);
}