Advertisement
kartonman

ARC WELDER with two lights controlled by toggle

Sep 13th, 2021
308
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*AN ARC WELDER with two lights controlled by toggle
  2. you can comment out the toggle and have this run continuously.
  3. See complete documentation and ways to use this sketch at
  4. */
  5.  
  6. #define ledPin 5 // LED connected to digital pin 5
  7. #define ledPin2 6 // LED connected to digital pin 6
  8. #define toggle 12
  9.  
  10. void setup()
  11. {
  12. pinMode(ledPin, OUTPUT);
  13. pinMode(ledPin2, OUTPUT);
  14. pinMode(toggle, INPUT_PULLUP);
  15. }
  16.  
  17. void loop()
  18. {
  19. if (digitalRead(toggle) == HIGH)
  20. {
  21. int i, count;
  22. count = random(10, 60);
  23. for (i = 0; i < count; i++)
  24. {
  25. digitalWrite(ledPin, HIGH); // set the LED on
  26. delay(random(80));
  27. digitalWrite(ledPin2, HIGH); // set the LED on
  28. delay(random(60));
  29. digitalWrite(ledPin, LOW); // set the LED off
  30. digitalWrite(ledPin2, LOW); // set the LED off
  31. delay(random(200));
  32. }
  33.  
  34. delay(random(800, 2000));
  35. }
  36. }
  37.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement