Description
Control LED status
For Arduino DIY project
Working Voltage: 5V
Output: Digital output (0/1)
PWM output
Material: PCB
Color: Black
Dimensions: 0.91 x 0.79 x 0.59 inch / 2.3 x 2.0 x 1.5 cm
Example code:
//KY017 Mercury open optical module int Led = 13 ;// define LED Interface int buttonpin = 3; // define the mercury tilt switch sensor interface int val ;// define numeric variables val void setup() { pinMode(Led, OUTPUT) ;// define LED as output interface pinMode(buttonpin, INPUT) ;// define the mercury tilt switch sensor output interface } void loop() { val = digitalRead(buttonpin) ;// read the values assigned to the digital interface 3 val if (val == HIGH) { // When the mercury tilt switch sensor detects a signal, LED flashes digitalWrite(Led, HIGH); } else { digitalWrite(Led, LOW); } }
![]()
Reviews
There are no reviews yet.