Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1.  
  2.  
  3. // constants won't change. Used here to set a pin number :
  4. const int ledPin = 13; // the number of the LED pin
  5.  
  6. const int switchpin = 12;
  7. const int rpmpin = 10;
  8.  
  9. // Variables will change :
  10. int ledState = LOW; // ledState used to set the LED
  11.  
  12. // Generally, you shuould use "unsigned long" for variables that hold time
  13. // The value will quickly become too large for an int to store
  14. unsigned long previousMillis = 0; // will store last time LED was updated
  15.  
  16. // constants won't change :
  17. const long interval = 1000; // interval at which to blink (milliseconds)
  18.  
  19. unsigned long m = 0;
  20. unsigned long n = 0;
  21.  
  22. void setup() {
  23. // set the digital pin as output:
  24. pinMode(ledPin, OUTPUT);
  25. pinMode(switchpin,INPUT);
  26. pinMode(rpmpin,OUTPUT);
  27. digitalWrite(rpmpin,LOW);
  28. digitalWrite(switchpin,LOW);
  29. digitalWrite(ledPin,LOW);
  30. }
  31.  
  32. const int del = 7;
  33.  
  34. void loop()
  35. {
  36.  
  37. digitalWrite(ledPin,HIGH);
  38. pinMode(switchpin,OUTPUT);
  39. delay(4000);
  40.  
  41. digitalWrite(rpmpin,HIGH);
  42. delay(9); //30ms = slow 15 = med 10 = fast
  43. digitalWrite(rpmpin,LOW);
  44. delay(9);
  45. digitalWrite(rpmpin,HIGH);
  46. delay(8); //30ms = slow 15 = med 10 = fast
  47. digitalWrite(rpmpin,LOW);
  48. delay(8);
  49. digitalWrite(rpmpin,HIGH);
  50. delay(7); //30ms = slow 15 = med 10 = fast
  51. digitalWrite(rpmpin,LOW);
  52. delay(7);
  53. digitalWrite(rpmpin,HIGH);
  54. delay(6); //30ms = slow 15 = med 10 = fast
  55. digitalWrite(rpmpin,LOW);
  56. delay(6);
  57. digitalWrite(rpmpin,HIGH);
  58. delay(2); //30ms = slow 15 = med 10 = fast
  59. digitalWrite(rpmpin,LOW);
  60. delay(2);
  61.  
  62. delay(5);
  63. pinMode(switchpin,INPUT);
  64.  
  65. delay(5000);
  66. digitalWrite(ledPin,LOW);
  67. delay(1000);
  68.  
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement