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);
}
}
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);
}
}
لماذا تتسوق معنا
تسوق بثقة
شحن سريع
إرجاع مجاني
دفع آمن
ضمان 30 يوماً
الدعم
الأسئلة الشائعة
المراجعات
مراجعات العملاء
كن أول من يشارك تجربته
ماذا يقول العملاء
لا توجد مراجعات بعد. اشتريت هذا المنتج؟ شارك رأيك أدناه.