lunt i an laboratory 5
TRANSCRIPT
-
8/12/2019 Lunt i an Laboratory 5
1/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
0 Tweet 0
Search
topics
android app
arduino
code
do it yourself
Extra
gadgets
hacking gadgets
5Like Share
Using Tilt Sensor / Direction
Detector With Arduino
Posted on December 28, 2012by admin
...
Using a Tilt Sensor / Direction Detector from e-Gizmo
Mechatronix Central.
Home Arduino Tutorials About Me
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2F&text=Using%20Tilt%20Sensor%20%2F%20Direction%20Detector%20With%20Arduino%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2Fhttp://www.luntianlaboratory.com/http://www.luntianlaboratory.com/arduino-tutorials/http://www.luntianlaboratory.com/about/http://www.luntianlaboratory.com/http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2F&text=Using%20Tilt%20Sensor%20%2F%20Direction%20Detector%20With%20Arduino%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2Fhttp://www.luntianlaboratory.com/category/android-app/http://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/category/code/http://www.luntianlaboratory.com/category/diy/http://www.luntianlaboratory.com/category/extra/http://www.luntianlaboratory.com/category/gadgets/http://www.luntianlaboratory.com/category/hacking/http://www.luntianlaboratory.com/category/byte/http://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/arduino-tutorials/http://www.luntianlaboratory.com/about/ -
8/12/2019 Lunt i an Laboratory 5
2/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
ust oo ng
my projects
Software
recent art ic les
Western Digital My Passport
1TB
Intel RST for Cooler Platform
Controller Hub (PCH)
I Installed a Lincensed ESET
NOD32 Antivirus!
The Tale of Impulsive Upgrader |
From Windows.3x to Windows 8
/ 8.1
Bluetooth File Transfer Protocol
Version 2
Blocking The Globe Tattoo
Ghost Web Icon
A Laptop Cooling Pad Test
recent comments
tan on Fixing the Slow Arduino
/****************************************
Connection instructions:
- connect VCC to 3.5 volts only
- connect GROUND to GROUND
- connect A to Arduino pin 2
- connect B to Arduino pin 3
*****************************************/
// A and B assigned to
// pin 2 and 3
http://www.luntianlaboratory.com/category/software/http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/category/byte/http://www.luntianlaboratory.com/category/projects/http://www.luntianlaboratory.com/category/software/http://www.luntianlaboratory.com/gadgets/western-digital-my-passport/http://www.luntianlaboratory.com/gadgets/intel-rst-cool-pch/http://www.luntianlaboratory.com/software/licensed-eset-nod32/http://www.luntianlaboratory.com/extra/from-windows-95-to-windows-8/http://www.luntianlaboratory.com/android-app/bftp-2-tutorial/http://www.luntianlaboratory.com/extra/globe-tattoo-ghost-icon/http://www.luntianlaboratory.com/gadgets/laptop-cooling-pad/http://www.luntianlaboratory.com/arduino/slow-arduino-ide-fix/#comment-2832http://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/attachment/e-gizmo-tilt-sensor-direction-detector/http://www.luntianlaboratory.com/arduino/slow-arduino-ide-fix/#comment-2832 -
8/12/2019 Lunt i an Laboratory 5
3/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Delay
Aldionon The Huawei Mobile
Pocket Wifi E5220
Aldionon The Huawei Mobile
Pocket Wifi E5220
admin on Gizduino Mini onWindows 7 and Windows 8
loreen on Gizduino Mini on
Windows 7 and Windows 8
tags
androidarduinobatterycameracomputerddwrt
electricityepsonfanfreedom
planglobehard diskhard
drivehuaweiinternet
laptoplcdldrledledslinux
mmorpgmotormp3phone
potentiometerpower supplypsu
push buttonqosroutersamsung
const byte A = 2;
const byte B = 3;
// Two variables the will hold
// the readings from A and B
// pins
byte readingA;
byte readingB;
void setup() {//void setup begin
// initialize serial monitor
Serial.begin(9600);
// declare pins A and b
// as inputs
pinMode(A,INPUT);
pinMode(B,INPUT);
}//void setup end
void loop() {//void loop begin
// Get values from pins A and B
// using digitalRead
readingA = digitalRead(A);
readingB = digitalRead(B);
// Display values on serial
// monitor
Serial.print(readingA);
Serial.print(" ");
Serial.println(readingB);
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/slow-arduino-ide-fix/#comment-2832http://signal/http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2831http://signal/http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2830http://www.luntianlaboratory.com/arduino/gizduino-mini-7-8/#comment-2829http://www.luntianlaboratory.com/arduino/gizduino-mini-7-8/#comment-2827http://www.luntianlaboratory.com/tag/android/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/battery/http://www.luntianlaboratory.com/tag/camera/http://www.luntianlaboratory.com/tag/computer/http://www.luntianlaboratory.com/tag/ddwrt/http://www.luntianlaboratory.com/tag/electricity/http://www.luntianlaboratory.com/tag/epson/http://www.luntianlaboratory.com/tag/fan/http://www.luntianlaboratory.com/tag/freedom-plan/http://www.luntianlaboratory.com/tag/globe/http://www.luntianlaboratory.com/tag/hard-disk/http://www.luntianlaboratory.com/tag/hard-drive/http://www.luntianlaboratory.com/tag/huawei/http://www.luntianlaboratory.com/tag/internet/http://www.luntianlaboratory.com/tag/laptop/http://www.luntianlaboratory.com/tag/lcd/http://www.luntianlaboratory.com/tag/ldr/http://www.luntianlaboratory.com/tag/led/http://www.luntianlaboratory.com/tag/leds/http://www.luntianlaboratory.com/tag/linux/http://www.luntianlaboratory.com/tag/mmorpg/http://www.luntianlaboratory.com/tag/motor/http://www.luntianlaboratory.com/tag/mp3/http://www.luntianlaboratory.com/tag/phone/http://www.luntianlaboratory.com/tag/potentiometer/http://www.luntianlaboratory.com/tag/power-supply/http://www.luntianlaboratory.com/tag/psu/http://www.luntianlaboratory.com/tag/push-button/http://www.luntianlaboratory.com/tag/qos/http://www.luntianlaboratory.com/tag/router/http://www.luntianlaboratory.com/tag/samsung/ -
8/12/2019 Lunt i an Laboratory 5
4/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
sd cardseven segmentssmartsony
stepper motorsun cellular
tattootoshibausbwifi
windowswirewordpress
// half second delay to prevent
// massive data transfer
delay(500);
}// void loop end
The initial wiring. Dont be misled, the blue wire is not connected.
Hold the sensor like this and open the serial monitor. Tilt the
sensor to front.. to back to left then to right. Watch as the
value change.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/tag/sd-card/http://www.luntianlaboratory.com/tag/seven-segments/http://www.luntianlaboratory.com/tag/smart/http://www.luntianlaboratory.com/tag/sony/http://www.luntianlaboratory.com/tag/stepper-motor/http://www.luntianlaboratory.com/tag/sun-cellular/http://www.luntianlaboratory.com/tag/tattoo/http://www.luntianlaboratory.com/tag/toshiba/http://www.luntianlaboratory.com/tag/usb/http://www.luntianlaboratory.com/tag/wifi/http://www.luntianlaboratory.com/tag/windows/http://www.luntianlaboratory.com/tag/wire/http://www.luntianlaboratory.com/tag/wordpress/http://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/attachment/wiring-tilt-sensor-to-arduino-uno/ -
8/12/2019 Lunt i an Laboratory 5
5/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
A code modification displaying either of four directions instead of
0s and 1s.
const byte A = 2;
const byte B = 3;
byte readingA;
byte readingB;
void setup() {//void setup begin
Serial.begin(9600);
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/attachment/tilt-sensor-with-crude-direction-label/ -
8/12/2019 Lunt i an Laboratory 5
6/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
pinMode(A,INPUT);
pinMode(B,INPUT);
}//void setup end
void loop() {//void loop begin
readingA = digitalRead(A);
readingB = digitalRead(B);
// a portion to display either of
// four directions depending on
// tilt position
if (readingA == 0 && readingB == 0) {
Serial.println("GOING FRONT");
}
if (readingA == 1 && readingB == 1) {
Serial.println("GOING BACK");
}
if (readingA == 0 && readingB == 1) {
Serial.println("GOING LEFT");
}
if (readingA == 1 && readingB == 0) {
Serial.println("GOING RIGHT");
}
// a delay to lessen massive data
// transfer
delay(500);
}// void loop end
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
8/12/2019 Lunt i an Laboratory 5
7/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
I mounted the sensor on breadboard. Added four LEDs to
indicate tilt direction.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/attachment/tilt-capture/ -
8/12/2019 Lunt i an Laboratory 5
8/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
const byte A = 2;
const byte B = 3;
// four Arduino pins
// to light four LEDs
const byte frontled = 5;const byte backled = 6;
const byte rightled = 7;
const byte leftled = 8;
byte readingA;
byte readingB;
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/attachment/tilt-sensor-with-leds-and-arduino-uno/ -
8/12/2019 Lunt i an Laboratory 5
9/14
df d mi b PRO i Are you a developer? Try out the HTML to PDF API
void setup() {//void setup begin
pinMode(A,INPUT);
pinMode(B,INPUT);
// indicate four pins as
// outputs
pinMode(backled,OUTPUT);
pinMode(frontled,OUTPUT);
pinMode(leftled,OUTPUT);
pinMode(rightled,OUTPUT);
}//void setup end
void loop() {//void loop begin
// digital read OUTPUT A and B
// from sensorreadingA = digitalRead(A);
readingB = digitalRead(B);
// Light a LED indicating tilt
// direction
if (readingA == 0 && readingB == 0) {
digitalWrite(frontled,HIGH);
digitalWrite(leftled,LOW);digitalWrite(backled,LOW);
digitalWrite(rightled,LOW);
}
if (readingA == 1 && readingB == 1) {
digitalWrite(backled,HIGH);
digitalWrite(leftled,LOW);
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
8/12/2019 Lunt i an Laboratory 5
10/14
df di b PRO i Are you a developer? Try out the HTML to PDF API
digitalWrite(frontled,LOW);
digitalWrite(rightled,LOW);
}
if (readingA == 0 && readingB == 1) {
digitalWrite(rightled,HIGH);
digitalWrite(leftled,LOW);
digitalWrite(backled,LOW);
digitalWrite(frontled,LOW);
}
if (readingA == 1 && readingB == 0) {
digitalWrite(leftled,HIGH);
digitalWrite(frontled,LOW);
digitalWrite(backled,LOW);
digitalWrite(rightled,LOW);
}
}// void loop end
RELATED POSTS
1. The US-100 Ultrasonic Distance Sensor Arduino Demo
Code
2. Arduino Tutorial Series Running Epson Stepper MotorEM-546
3. Arduino Tutorial Series The On-board Blinking LED
4. Playing LEDs, Button and Buzzer With Arduino
...
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/code/us-100-distance-sensor/http://www.luntianlaboratory.com/hacking/epson-stepper-em-546/http://www.luntianlaboratory.com/arduino/on-board-blinking-led/http://www.luntianlaboratory.com/code/play-button-leds-buzzer/ -
8/12/2019 Lunt i an Laboratory 5
11/14
df di b PRO i A d l ? T t th HTML t PDF API
2 T HOUGHTS ON USING TILT SENSOR / DIRECTION DETECTOR WITH ARDUINO
0 Tweet 0
This entry was posted in arduinoand tagged arduino, direction detector, tilt
sensorby admin. Bookmark the permalink.
5Like Share
maad on April 15, 2013 at 5:05 am said:
Excellent application! congrats
Reply
Sef on August 20, 2013 at 7:02 amsaid:
Hello,
Thank you for a very straight-forward tutorials on
gizduino. Ive learned a lot as a beginner.
Ive just purchased sd card shield from gizduino. Im a
little bit lost how to connect it with the gizduino. Can you
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2F&text=Using%20Tilt%20Sensor%20%2F%20Direction%20Detector%20With%20Arduino%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Ftilt-direction-detector-arduino%2Fhttp://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/direction-detector/http://www.luntianlaboratory.com/tag/tilt-sensor/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/http://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/?replytocom=671#respond -
8/12/2019 Lunt i an Laboratory 5
12/14df di b PRO i A d l ? T t th HTML t PDF API
do a tutorial about it? Thank you.
Cheers,
Sef
Reply
Leave a Reply
Your email address will not be published. Required fields are
marked *
Name *
Email *
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/tilt-direction-detector-arduino/?replytocom=1662#respond -
8/12/2019 Lunt i an Laboratory 5
13/14df di b PRO i
Are you a developer? Try out the HTML to PDF API
LDPE Cushion To Protect Arduino Shield Male Pins
Arduino RF Wireless Module Setup JZ863
by luntianlaboratory.com 2010-2012see change log, site rules & stuff
posts with pictures of luntiancorner.com were moved articles. they are owned by the same author
Post Comment
Website
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/diy/protect-arduino-male-pins/http://www.luntianlaboratory.com/arduino/arduino-rf-module-sketch/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/about/http://www.luntianlaboratory.com/about/ -
8/12/2019 Lunt i an Laboratory 5
14/14Are you a developer? Try out the HTML to PDF API
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2ftilt-direction-detector-arduino%2f&id=ma-140324195304-46a7752ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf