Last active
January 18, 2021 15:21
-
-
Save alvesoaj/26be07c2867429df7e0e85d3b1952ab2 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
/* | |
* AJ Alves ([email protected]) | |
*/ | |
#define SENSOR_PIN 2 // Arduino pin that will read the sensor state | |
void setup() { | |
Serial.begin(9600); // Setup Serial Port | |
pinMode(SENSOR_PIN, INPUT); // Set pin as INPUT | |
} | |
void loop() { | |
int state = digitalRead(SENSOR_PIN); | |
if (state == HIGH) { | |
Serial.println("The barrel is FULL"); | |
} else { | |
Serial.println("No signal from sensor! It is emptying!"); | |
} | |
delay(1000); // Wait 1 second | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment