Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // constants won't change. Used here to set a pin number :
- const int ledPin = 13; // the number of the LED pin
- const int switchpin = 12;
- const int rpmpin = 10;
- // Variables will change :
- int ledState = LOW; // ledState used to set the LED
- // Generally, you shuould use "unsigned long" for variables that hold time
- // The value will quickly become too large for an int to store
- unsigned long previousMillis = 0; // will store last time LED was updated
- // constants won't change :
- const long interval = 1000; // interval at which to blink (milliseconds)
- unsigned long m = 0;
- unsigned long n = 0;
- void setup() {
- // set the digital pin as output:
- pinMode(ledPin, OUTPUT);
- pinMode(switchpin,INPUT);
- pinMode(rpmpin,OUTPUT);
- digitalWrite(rpmpin,LOW);
- digitalWrite(switchpin,LOW);
- digitalWrite(ledPin,LOW);
- }
- const int del = 7;
- void loop()
- {
- digitalWrite(ledPin,HIGH);
- pinMode(switchpin,OUTPUT);
- delay(4000);
- digitalWrite(rpmpin,HIGH);
- delay(9); //30ms = slow 15 = med 10 = fast
- digitalWrite(rpmpin,LOW);
- delay(9);
- digitalWrite(rpmpin,HIGH);
- delay(8); //30ms = slow 15 = med 10 = fast
- digitalWrite(rpmpin,LOW);
- delay(8);
- digitalWrite(rpmpin,HIGH);
- delay(7); //30ms = slow 15 = med 10 = fast
- digitalWrite(rpmpin,LOW);
- delay(7);
- digitalWrite(rpmpin,HIGH);
- delay(6); //30ms = slow 15 = med 10 = fast
- digitalWrite(rpmpin,LOW);
- delay(6);
- digitalWrite(rpmpin,HIGH);
- delay(2); //30ms = slow 15 = med 10 = fast
- digitalWrite(rpmpin,LOW);
- delay(2);
- delay(5);
- pinMode(switchpin,INPUT);
- delay(5000);
- digitalWrite(ledPin,LOW);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement