Advertisement
Guest User

arduino pro micro left mouse button

a guest
Jun 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <Mouse.h>
  2. int buttonPin = 10; // Set a button to any pin
  3.  
  4. void setup()
  5. {
  6. pinMode(buttonPin, INPUT); // Set the button as an input
  7. digitalWrite(buttonPin, HIGH); // Pull the button high
  8. }
  9.  
  10. void loop()
  11. {
  12. if (digitalRead(buttonPin) == 0) // if the button goes low
  13. {
  14. Mouse.press();
  15. delay(1);
  16.  
  17. }
  18. else {Mouse.release();}
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement