Created
January 6, 2020 05:39
-
-
Save futureshocked/3934b0e9cba045d3d773f369fb619e0d to your computer and use it in GitHub Desktop.
Use this sketch to detect when your Arduino is tilted. Connect a tilt sensor to Analog pin 0 (A0)
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 out; | |
void setup() | |
{ | |
Serial.begin(9600); // sets the serial port to 9600 | |
} | |
void loop() | |
{ | |
out = analogRead(0); // read analog input pin 0 | |
Serial.println(out, DEC); | |
delay(100); // wait 100ms for next reading | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment