Ks0025 keyestudio Digital Tilt Sensor: Difference between revisions
Jump to navigation
Jump to search
Keyestudio (talk | contribs) No edit summary |
Keyestudio (talk | contribs) |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<br> | |||
==Introduction== | ==Introduction== | ||
Tilt | Tilt sensor is a digital tilt switch. It can be used as a simple tilt sensor. | ||
<br>[[File: | Tilt sensors (tilt ball switch) allow you to detect orientation or inclination. They are small, inexpensive, low-power and easy-to-use. <br> | ||
Simply connect the sensor to our IO/Sensor shield, so you can make amazing interactive projects. | |||
<br>[[File:KS0025 (3).jpg|500px|frameless|thumb]]<br> | |||
<br> | |||
==Specification== | ==Specification== | ||
*Supply Voltage: 3.3V to 5V | *Supply Voltage: 3.3V to 5V | ||
*Interface: Digital | *Interface: Digital | ||
<br> | |||
==Connection Diagram == | ==Connection Diagram == | ||
<br>[[File:Ks0025.png|700px|frameless|thumb]]<br> | |||
<br> | |||
==Sample Code == | ==Sample Code == | ||
<pre> | <pre> | ||
Line 36: | Line 40: | ||
{ | { | ||
digitalWrite(ledPin, LOW); // Turn off LED when the sensor is not triggered | digitalWrite(ledPin, LOW); // Turn off LED when the sensor is not triggered | ||
}</pre> | } | ||
} | |||
</pre> | |||
<br> | |||
== Result == | |||
Upload the code to the board. Then tilt the sensor, you will see the led on the sensor is turned on. Shown as below. | |||
<br>[[File:KS0349 14-3.png|800px|frameless|thumb]]<br> | |||
<br> | |||
== Think == | |||
Or you can connect more an external LED module, then how to program? Think about it. The LED will turn on when tilt the sensor, and the LED will turn off when the sensor is not tilted.<br> | |||
For example: | |||
<br>[[File:KS0025 (6).jpg|500px|frameless|thumb]]<br> | |||
<br> | |||
==Resources == | |||
* '''Video'''<br> | |||
http://video.keyestudio.com/ks0025/ | |||
* '''PDF and Code'''<br> | |||
https://fs.keyestudio.com/KS0025 | |||
<br> | |||
==Buy from == | |||
*[https://www.keyestudio.com/free-shipping-keyestudio-digital-tilt-motion-sensor-module-for-arduino-p0160.html '''Official Website'''] | |||
*[https://www.aliexpress.com/store/product/Free-shipping-Keyestudio-Digital-Tilt-Motion-Sensor-module-for-arduino-uno-r3/4247007_32887892991.html?spm=2114.12010615.8148356.7.c8ba2fe8QUY3yq '''Shop on aliexpress'''] | |||
[[Category: Sensor]] | [[Category: Sensor]] |
Latest revision as of 14:46, 7 January 2021
Introduction
Tilt sensor is a digital tilt switch. It can be used as a simple tilt sensor.
Tilt sensors (tilt ball switch) allow you to detect orientation or inclination. They are small, inexpensive, low-power and easy-to-use.
Simply connect the sensor to our IO/Sensor shield, so you can make amazing interactive projects.
Specification
- Supply Voltage: 3.3V to 5V
- Interface: Digital
Connection Diagram
Sample Code
int ledPin = 13; // Connect LED to pin 13 int switcher = 3; // Connect Tilt sensor to Pin3 void setup() { pinMode(ledPin, OUTPUT); // Set digital pin 13 to output mode pinMode(switcher, INPUT); // Set digital pin 3 to input mode } void loop() { if(digitalRead(switcher)==HIGH) //Read sensor value { digitalWrite(ledPin, HIGH); // Turn on LED when the sensor is tilted } else { digitalWrite(ledPin, LOW); // Turn off LED when the sensor is not triggered } }
Result
Upload the code to the board. Then tilt the sensor, you will see the led on the sensor is turned on. Shown as below.
Think
Or you can connect more an external LED module, then how to program? Think about it. The LED will turn on when tilt the sensor, and the LED will turn off when the sensor is not tilted.
For example:
Resources
- Video
http://video.keyestudio.com/ks0025/
- PDF and Code
https://fs.keyestudio.com/KS0025