Instructions
IDUINO for maker’s life
72 www.openplatform.cc
int buttonpin = 7; // 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 7 val
if (val == HIGH) // When the mercury tilt switch sensor detects
a signal, LED flashes
{
digitalWrite (Led, HIGH);
}
else
{
digitalWrite (Led, LOW);
}
}
******Code End******