Back to search
Ball Tilt Switch Module
Ball Tilt Switch Module
Ball Tilt Switch Module
1 / 2
View on seller's websitePrices and availability are updated daily. Please confirm on the seller's website before buying.
Tiah

Ball Tilt Switch Module

Sensors & modules

DZD 300

View on seller's websitePrices and availability are updated daily. Please confirm on the seller's website before buying.
Description

Description

This ball tilt switch module can detect when it is tilted. It works because a ball flows into the gap between two electrodes and completes the circuit when the module is tilted at an angle.

Test Code

int Led = 13; // define LED Interface
int buttonpin = 3; // define the tilt switch sensor interfaces
int val; // define numeric variables val

void setup () {
pinMode(Led, OUTPUT); // define LED as output interface
pinMode(buttonpin, INPUT); // define the output interface tilt switch sensor
}

void loop () {
val = digitalRead(buttonpin); // digital interface will be assigned a value of 3 to read val

// When the tilt sensor detects a signal when the switch, LED flashes
if (val == HIGH) {
digitalWrite(Led, HIGH);
}
else {
digitalWrite(Led, LOW);
}
}

Similar products

5A Adjustable CC CV Display Step Down Charge Module LED Panel Voltmeter Ammeter
View
5A Adjustable CC CV Display Step Down Charge Module LED Panel Voltmeter Ammeter
DZD 2,100

Sensors & modules

Tiah