SHARE
TWEET

ball

inventrkits Jan 22nd, 2020 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int Led = 13 ;// define LED Interface
  2. int buttonpin = 3; // define the tilt switch sensor interfaces
  3. int val ;// define numeric variables val
  4. void setup ()
  5. {
  6.   pinMode (Led, OUTPUT) ;// define LED as output interface
  7.     pinMode (buttonpin, INPUT) ;//define the output interface tilt switch sensor
  8. }
  9. void loop ()
  10. {
  11.   val = digitalRead (buttonpin) ;// digital interface will be assigned a value of 3 to read val
  12.     if (val == HIGH) //When the tilt sensor detects a signal when the switch, LED flashes
  13.   {
  14.     digitalWrite (Led, HIGH);
  15.   }
  16.   else
  17.   {
  18.     digitalWrite (Led, LOW);
  19.   }
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top