fanfannnmn

AnimalRestaurantClicker.c

Dec 1st, 2020
858
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Mouse.h>
  2. #include <HID.h>
  3.  
  4. // #define CYCLE 32
  5. #define MAX_INPUT 3200 // CYCLE * 100
  6. #define BREAK 480 // CYCLE * 15
  7. #define SBREAK 16 // CYCLE / 2
  8.  
  9. int counter = 0;
  10.  
  11. void setup()
  12. {
  13.   Serial.begin(9600);
  14.   randomSeed(analogRead(0));
  15.   pinMode(LED_BUILTIN, OUTPUT);
  16.   digitalWrite(LED_BUILTIN, HIGH);
  17.   delay(5000);
  18.   digitalWrite(LED_BUILTIN, LOW);
  19.   Mouse.begin();
  20. }
  21.  
  22. void loop()
  23. {
  24.   if (counter < MAX_INPUT) {
  25.     if (counter % SBREAK == 0) {
  26.       MoveAndClick(400, 90);
  27.     } else {
  28.       MoveAndClick(100, 250);
  29.     }
  30.    
  31.     counter++;
  32.  
  33.     if (counter % BREAK == 0) {
  34.       digitalWrite(LED_BUILTIN, HIGH);
  35.       delay(random(15000, 30000));
  36.       digitalWrite(LED_BUILTIN, LOW);
  37.     }
  38.   }
  39.   else {
  40.     flash();
  41.   }
  42. }
  43.  
  44. void flash() {
  45.   digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  46.   delay(1000);                       // wait for a second
  47.   digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  48.   delay(1000);                       // wait for a second
  49. }
  50.  
  51. void MoveAndClick(int mins, int maxs){
  52.   int x = random(0, 10);
  53.   int y = random(0, 10);
  54.   Mouse.move(x, y, 0);
  55.   Mouse.click();
  56.   delay(random(mins, maxs));
  57.   Mouse.move(-x, -y, 0);
  58. }
RAW Paste Data