• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoLinkSprite Sensor Pack 101Sample Code for Tilt Sensor breakout
Previous Next

Sample Code for Tilt Sensor breakout

Posted by: admin , January 8, 2014

[vc_row][vc_column width=”1/1″][vc_column_text]Ball-rolling tilt sensor breakout board use ball-rolling device to detect the tilt.

There are three pins: Power, Ground and outpout digital signal.

Tilt sensor BB.jpg[/vc_column_text][vc_tour][vc_tab title=”Parts List” tab_id=”1389200909-1-30″][vc_column_text]1 x Tile Sensor Breakout

1 x pcDuino v2

Several Jump Wires[/vc_column_text][/vc_tab][vc_tab title=”Wire Diagram” tab_id=”1389200909-2-60″][vc_column_text] 

tilt_wire

+ of tilt sensor -> 5V of pcDuino

– of tilt sensor -> GND of pcDuino

S of tilt sensor -> GPIO 0 of pcDuino

 [/vc_column_text][/vc_tab][vc_tab title=”Sample Code” tab_id=”1389201222752-2-10″][vc_column_text]

We use the included Arduino IDE in pcDuino:

vibration_sample

Sample Code:

#include <core.h>

int PathPin = 0;

void setup(){
pinMode(PathPin, INPUT);

}

void loop(){
int sensorValue = digitalRead(PathPin);

printf(“Value of Pin pathpin:%d\n”, sensorValue);

delay(100);
}

[/vc_column_text][/vc_tab][vc_tab title=”Results” tab_id=”1389201247452-3-0″][vc_column_text]

Click the left-point arrow to run the code on pcDuino, when there is no tilt, the sensor output will be 1, and will be 0 when there is no tilt.

The following screen shows tilt was not detected.

yesvibration

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: LinkSprite Sensor Pack 101

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors