Skip to content

Instantly share code, notes, and snippets.

@jpliew
Created March 25, 2020 06:41
Show Gist options
  • Save jpliew/04eeadf1b7373d97f02ec1282f3d99bd to your computer and use it in GitHub Desktop.
Save jpliew/04eeadf1b7373d97f02ec1282f3d99bd to your computer and use it in GitHub Desktop.
Tutorial 3 - 2A
int sensorPin = 2;
int isTilted = 0;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
}
void loop() {
isTilted=digitalRead(sensorPin);
if (isTilted) {
Serial.println("Tilted");
} else {
Serial.println("NOT Tilted");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment