• +965 51122049
Mercury open optical module

Mercury open optical module

KWD1.000KWD1.000
0%Off

Mercury open optical module


 

 


Share:

Mercury switch module and a digital interface, built-in 13 LED build a simple circuit to produce tilt warning lamp 13 comes with digital interfaces of the LED, the mercury tilt switch sensor interface to access digital 3, when the tilt switch sensor senses a key signal, LED lights, otherwise off.

Schematic

  • Arduino GND --> Pin - of module
  • Arduino 5+ --> Pin middel of module
  • Arduino 3 --> pin S of module

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)
	
	;
	
	
  }
	
	
}
	
	

Add your review

Your email address will not be published. Required fields are marked *

Please login to write review!

Upload photos

Looks like there are no reviews yet.

Related Products