/******************************************************** ** Download from: ** ** http://www.alhin.de/arduino/index.php?n=44 ** ********************************************************/ #include <AH_EasyDriver.h> //AH_EasyDriver(int RES, int DIR, int STEP); // RES -> RESOLUTION per full revolve // DIR -> DIRECTION PIN // STEP -> STEPPING PIN AH_EasyDriver stepper(200,9,8); // Initialisation // DIR-Pin = Pin 9 // STEP-Pin = Pin 8 const int buttonPin = 2; // the number of the pushbutton pin int sensorPin = A0; // Analoger Input für die Spannung der Photodiode - analog input for the photodiode-voltage int U_photodiode; // Wert der Photodiodenspannung - voltagevalue of the photodiode void setup() { Serial.begin(57600); pinMode(buttonPin, INPUT); stepper.setSpeedRPM(20); // RPM , rotations per minute // RPM = 1 entspricht einer Umlaufszeit von 30 Sekunden!!! // RPM = 10 entspricht einer Umlaufszeit von 3 Sekunden!!! // RPM = 20 entspricht einer Umlaufszeit von 1.5 Sekunden!!! // ======================================================= //stepper.setMicrostepping(3); // 0 -> Full Step // 1 -> 1/2 microstepping // 2 -> 1/4 microstepping // 3 -> 1/8 microstepping //stepper.setSpeedHz(100); // Hz, steps per second stepper.move(1000,1); // Bewegt den Schrittmotor in die Startposition - move the stepper motor to the starting position } void loop() { while(digitalRead(buttonPin)); { // waiting start-button pressed; } Serial.println(" "); Serial.println("========================================================================"); Serial.println("komplett neue Messserie mit xxx Scans"); Serial.println(" "); for(int i = 1; i <= 20; i++) // Anzahl der Scans der Flüssigkeit = 20 { Serial.println(" "); Serial.print(i); Serial.println("-ter Scan:"); Serial.println(" "); for(int j = 1; j <= 250; j++) // Anzahl der Schritte eines einzelnen Scans { U_photodiode = analogRead(sensorPin); // Einlesen der Photodiodenspannung - reading of the photodiode-voltage Serial.println(U_photodiode); stepper.move(4,0); // Stepperschritte nach oben nach jeder Messung - steps upwards after each measurement delay(20); } stepper.move(250*4,1); // Laser wieder zurück zur Startposition - laser back to the starting position delay(10000); // Delay zwischen den einzelnen Scans - delay between the scans } }