DriP is a reminder that time has a way at eroding even the hardest of materials. A single drop of water falls once a minute onto a marble slab eventually boring a hole through it.
DriP is a reminder that time has a way at eroding even the hardest of materials. A single drop of water falls once a minute onto a marble slab eventually boring a hole through it. The time of the drop can be changed through the code. It might be be interesting to add some kind of timing control to circuit, allowing the user to set the interval.
byte directionPin = 9; byte stepPin = 8; int numberOfSteps = 500; byte ledPin = 13; int pulseWidthMicros = 20; // microseconds int millisbetweenSteps = 1; // milliseconds - or try 1000 for slower steps unsigned long startMillis; unsigned long currentMillis; const unsigned long period = 60000; void setup() { pinMode(directionPin, OUTPUT); pinMode(stepPin, OUTPUT); pinMode(ledPin, OUTPUT); digitalWrite(directionPin, HIGH); Serial.begin(9600); Serial.println("Starting StepperTest"); digitalWrite(ledPin, LOW); // delay(1); startMillis = millis(); } void loop() { currentMillis = millis(); if (currentMillis - startMillis > period) // digitalWrite(directionPin, HIGH); { for (int n = 0; n < numberOfSteps; n++) { digitalWrite(stepPin, HIGH); // delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary digitalWrite(stepPin, LOW); delay(millisbetweenSteps); digitalWrite(ledPin, !digitalRead(ledPin)); startMillis = currentMillis; } } delay(1); }