Created
March 25, 2020 06:41
-
-
Save jpliew/04eeadf1b7373d97f02ec1282f3d99bd to your computer and use it in GitHub Desktop.
Tutorial 3 - 2A
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 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