Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int State = LOW;
- long previousMillis = 0;
- long interval = 1000;
- long totalTime = 60000;
- void setup() {
- }
- void loop() {
- unsigned long currentMillis = millis();
- //***************************************************
- // start of TotalTime
- if (currentMillis < totalTime) {
- if (currentMillis - previousMillis > interval) {
- previousMillis = currentMillis;
- if (State == LOW) {
- State = HIGH;
- //front
- }
- else {
- State = LOW;
- //back
- }
- }
- }//end of TotalTime
- //***************************************************
- else{
- //stop
- }
- }// end of loop
Advertisement
Add Comment
Please, Sign In to add comment