RUG Community

a place for robotic enthusiasts, builders and user groups

Seeedstudio Tilt Sensor Tutorial



Introduction


The purpose of this tutorial is to demonstrate what it is like to work with a tilt sensor. These sensors are typical an on/off type sensor. Therefore, it is placed on a GPIO or Digital Pin and you simple read from the pin. If its high you are titled - if its low you are not.

Overview


For this tutorial we used the Seeedstudio Electronic Brick Starter kit which includes various sensors, components, cables and a shield to help get you started with various Seeedstudio Arduino compatible microcontrollers.



Meat and Potatoes


We like to get straight to the point. Below you will find the same code used to work with the tilt sensor. Take into account that this is a basic code example. We do not get into the all the details of how or why you would use a tilt sensor. Merely, how to code for it.

Sample Code
#include 

LiquidCrystal lcd(10,11,12,13,14,15,16);

int tiltSensorPin = 8;

void setup()
{
  Serial.begin( 9600 );
  
  lcd.begin(16, 2);
  lcd.clear();
  
  pinMode( tiltSensorPin, INPUT );
}

int tiltReading = 0;

void loop()
{
  tiltReading = digitalRead( tiltSensorPin );
  
  lcd.setCursor(0,0);
  lcd.print( tiltReading );
  
  delay(1000);
  
  lcd.clear();
}


Where to buy?


DIYbin.com

Latest Activity

yos sh posted photos
Friday
yos sh posted a photo
Friday
Profile IconDan Moldovan, Andrew Nguyen, Simon Vans-Colina and 1 more joined RUG Community
Friday
Richard Vannoy posted an event

Mini-Sumo Contest at San Diego, near I-15 and Aero Drive

June 2, 2012 from 10am to 2pm
2 June 2012, NoonITT Technical Institute9680 Granite Ridge DriveSan Diego, California, 92123Robots: 20 cm max width, 20 cm max length, max 500 gramsSee: www.richardvannoy.info/sumo.php for rules and detailsRVannoy@itt-tech.eduSee More
Friday
Richard Vannoy updated their profile
May 19
Peter Farkas updated their profile
May 15
Peter Farkas posted a video

Pneumatic Gripper Hass VMC by WPI

Pneumatic gripper used in Haas vertical machining center for Worcester Polytechnic Institute project. Worcester Polytechnic Institute's Robotics Engineering ...
May 15
Peter Farkas posted a blog post

WPI student integrates Robotic manipulator in Haas CNC machining center

AGI American Grippers Inc in Trumbull, CT, a loyal supporter of Manufacturing, Robotic Engineering and Industrial Automation related discipline programs in Universities throughout the USA, donated pneumatic automation equipment to WPI student Corey Stevens on April of 2012 for use in a project required for the completion of his Robotics Engineering undergraduate degree at Worcester Polytechnic Institute in Massachusetts.  WPI is ranked among the best Engineering schools in the country, and “is…See More
May 15
Profile IconSam Nakagawa, Nghiem Hai Bang, Tim Scott and 10 more joined RUG Community
May 14
iofreak updated their profile
Apr 28
Profile IconTim Hunter, Stan Wall and Thammarat joined RUG Community
Apr 27
Profile IconDavid Bleeke, marco villalon, Александр and 24 more joined RUG Community
Apr 24
Joseph Pavliga posted videos
Mar 31
Joseph Pavliga posted videos
Mar 26
Profile IconCamila Passoni, khaled Kamal, oderlachs and 19 more joined RUG Community
Mar 26
Profile IconHector Gato, shoppink, Andrei and 18 more joined RUG Community
Mar 1

© 2012   Created by Danny.

Badges  |  Report an Issue  |  Terms of Service

Add Videos | Add Photos | Post a Blog | Add Events | Discuss | Form a Group

Sign Up  Invite