Last active
May 13, 2018 09:38
-
-
Save arduinothai/8750d8898fbed0ca6b145fc56b15250b to your computer and use it in GitHub Desktop.
This file contains 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 sensorPin = 2; | |
int sensorValue = 0; | |
void setup() { | |
// declare the ledPin as an OUTPUT: | |
Serial.begin(9600); | |
} | |
void loop() { | |
// read the value from the sensor: | |
sensorValue = digitalRead(sensorPin); | |
delay(100); | |
Serial.print("sensor = " ); | |
Serial.println(sensorValue); | |
if(sensorValue == 0) | |
{ | |
Serial.println("...QUIET"); | |
} | |
else | |
{ | |
Serial.println("........LOUD"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment