Created
August 31, 2021 00:26
-
-
Save esteves67/43266bc592afc0162bc79e64d005c0dd to your computer and use it in GitHub Desktop.
PTT Arduino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int analogPin = 0; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(LED_BUILTIN, OUTPUT); | |
digitalWrite(LED_BUILTIN, LOW); | |
pinMode(4, OUTPUT); | |
digitalWrite(4, HIGH); | |
} | |
void loop() { | |
int sensorValue = analogRead(A0); | |
int sensor = analogRead(A1); | |
float voltage = sensorValue * (5.0 / 1023.0); | |
Serial.println("-------------------------"); | |
Serial.println("Sensor A0 - abaixo"); | |
Serial.println(voltage); | |
Serial.println(sensorValue); | |
Serial.println("Sensor A1 - abaixo"); | |
Serial.println(sensor); | |
Serial.println("-------------------------"); | |
if (sensorValue < 20) { // Ajustar de Acordo com seu Celular e HT, testado com 777s + Galaxy Young, Galaxy J2, Galaxy J3 | |
digitalWrite(LED_BUILTIN, HIGH); | |
digitalWrite(4, LOW); | |
delay(500); | |
} | |
else { | |
digitalWrite(LED_BUILTIN, LOW); | |
digitalWrite(4, HIGH); | |
delay(500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment