daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Jan 25th, 2018 14 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "DigiKeyboard.h"
  2.  
  3. int Led = 1 ;// define LED Interface
  4. int buttonpin = 0; // define the photo interrupter sensor interface
  5. int val ;// define numeric variables val
  6. void setup ()
  7. {
  8.   pinMode (Led, OUTPUT) ;// define LED as output interface
  9.   pinMode (buttonpin, INPUT) ;// define the photo interrupter sensor output interface  
  10. }
  11. void loop ()
  12. {
  13.   val = digitalRead (buttonpin) ;// digital interface will be assigned a value of 3 to read val
  14.   if (val == HIGH) // When the light sensor detects a signal is interrupted, LED flashes
  15.   {
  16.     digitalWrite (Led, HIGH);
  17.     DigiKeyboard.sendKeyStroke(0);
  18.     DigiKeyboard.println(",");
  19.     DigiKeyboard.delay(200);
  20.     DigiKeyboard.sendKeyStroke(0);
  21.     DigiKeyboard.println(".");
  22.   }
  23.   else
  24.   {
  25.     digitalWrite (Led, LOW);
  26.   }
  27. }
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