Difference between revisions of "Tilt Module"
Line 1: | Line 1: | ||
[[File:Linker tilt2.jpg |400px]] | [[File:Linker tilt2.jpg |400px]] | ||
+ | == Sample == | ||
+ | |||
+ | <syntaxhighlight lang="c"> | ||
+ | |||
+ | const int ButtonPin=9; | ||
+ | void setup() { | ||
+ | pinMode(ButtonPin, INPUT); | ||
+ | Serial.begin(9600); // init serial to 9600b/s | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | int sensorValue = digitalRead(ButtonPin); | ||
+ | if(sensorValue==1) | ||
+ | { | ||
+ | Serial.println("Hign"); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | Serial.println("Low"); | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | </syntaxhighlight> | ||
== Schematics == | == Schematics == | ||
*[https://s3.amazonaws.com/linksprite/LinkerKit/Linker+Tilt.pdf Schematics] | *[https://s3.amazonaws.com/linksprite/LinkerKit/Linker+Tilt.pdf Schematics] |
Revision as of 12:45, 25 April 2013
Sample
<syntaxhighlight lang="c">
const int ButtonPin=9; void setup() {
pinMode(ButtonPin, INPUT); Serial.begin(9600); // init serial to 9600b/s
}
void loop() {
int sensorValue = digitalRead(ButtonPin); if(sensorValue==1) { Serial.println("Hign"); } else { Serial.println("Low"); } }
</syntaxhighlight>