SHARE
TWEET

touch

inventrkits Jan 22nd, 2020 65 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 Metal Touch Sensor Interface
  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 metal touch sensor output interface
  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 metal touch sensor detects a signal, 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