Skip to content

Instantly share code, notes, and snippets.

@arduinothai
Last active May 13, 2018 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arduinothai/8750d8898fbed0ca6b145fc56b15250b to your computer and use it in GitHub Desktop.
Save arduinothai/8750d8898fbed0ca6b145fc56b15250b to your computer and use it in GitHub Desktop.
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