projekte:kameraslider
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung | Nächste ÜberarbeitungBeide Seiten, nächste Überarbeitung | ||
projekte:kameraslider [2016/03/12 17:32] – markus | projekte:kameraslider [2016/10/04 20:56] – markus | ||
---|---|---|---|
Zeile 251: | Zeile 251: | ||
+ | |||
+ | </ | ||
+ | |||
+ | <file C SLIDER_NO_UI.ino> | ||
+ | /* | ||
+ | SLIDER_NO_UI.ino | ||
+ | created by Markus Buecher | ||
+ | markus@lug-saar.de | ||
+ | |||
+ | Feel free to contact me if you have any questions, ideas, critics or improvements. | ||
+ | |||
+ | RELEASE NOTES | ||
+ | Please note that this Version doesn' | ||
+ | in the head of this program. Feel free to copy this and build your own camslider. | ||
+ | **Version 1.0** | ||
+ | First release of the Arduino Program for Camslider. | ||
+ | ***WORKING: | ||
+ | -Initialisation | ||
+ | -Move from point to point | ||
+ | -Auto Reset after reaching the other end of line | ||
+ | |||
+ | ***NOT WORKING / NOT IMPLEMENTED*** | ||
+ | -RUNTIME (means to set a time which gives the duration of the real time duration of a timelapse for example) | ||
+ | | ||
+ | -Cameracontrol | ||
+ | -lots of more ideas | ||
+ | */ | ||
+ | |||
+ | //Pinout | ||
+ | const int END_STOP_LEFT = 5; //Left Endstop | ||
+ | const int END_STOP_RIGHT = 6; // | ||
+ | const int STEP_SIGNAL = 3; //Step Signal for Pololu --> STEP | ||
+ | const int DIRECTION_SIGNAL = 4; // | ||
+ | const int LED_INDICATOR = 2; //LED-Pin for Status Signal | ||
+ | |||
+ | //Global Variables | ||
+ | |||
+ | int STATE = 0; | ||
+ | int RUNTIME = 1000; | ||
+ | int long STEP_COUNTER = 0; //Counts the amounts of Step-Signals from the Arduino to the Driver | ||
+ | int MOVE_STEP_FROM_SWITCH = 200; //defines the amount of steps, the cartridge moves back from a collision with the endswitch | ||
+ | int MOVE_STEP = 1200; // | ||
+ | int EXPOSURE_TIME = 1; // | ||
+ | int FREQUENCY = 3000; //Set frequency for Step Signal (Steps per Second) | ||
+ | |||
+ | void setup() { //set pinModes to In- or Output | ||
+ | pinMode(END_STOP_LEFT, | ||
+ | pinMode(END_STOP_RIGHT, | ||
+ | pinMode(LED_INDICATOR, | ||
+ | pinMode(STEP_SIGNAL, | ||
+ | pinMode(DIRECTION_SIGNAL, | ||
+ | } | ||
+ | |||
+ | void step() { | ||
+ | digitalWrite(STEP_SIGNAL, | ||
+ | delayMicroseconds(1000000/ | ||
+ | digitalWrite(STEP_SIGNAL, | ||
+ | delayMicroseconds(1000000/ | ||
+ | ++STEP_COUNTER; | ||
+ | } | ||
+ | |||
+ | void loop() { // | ||
+ | |||
+ | switch (STATE) { // | ||
+ | case 0: // | ||
+ | while (digitalRead(END_STOP_RIGHT) == LOW) { | ||
+ | digitalWrite(DIRECTION_SIGNAL, | ||
+ | step(); | ||
+ | if (digitalRead(END_STOP_RIGHT) == HIGH) { | ||
+ | digitalWrite(DIRECTION_SIGNAL, | ||
+ | STEP_COUNTER = 0; | ||
+ | while (STEP_COUNTER <= MOVE_STEP_FROM_SWITCH) { | ||
+ | step(); | ||
+ | } | ||
+ | STATE = 1; | ||
+ | } | ||
+ | break; | ||
+ | } | ||
+ | break; | ||
+ | |||
+ | case 1: // | ||
+ | delay(1000*(EXPOSURE_TIME)); | ||
+ | while (1) { | ||
+ | digitalWrite(DIRECTION_SIGNAL, | ||
+ | STEP_COUNTER = 0; | ||
+ | while (STEP_COUNTER <= MOVE_STEP) { | ||
+ | if (digitalRead(END_STOP_LEFT) == HIGH) { | ||
+ | STATE = 2; | ||
+ | break; | ||
+ | } | ||
+ | else | ||
+ | step(); | ||
+ | } | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | case 2: // | ||
+ | while (digitalRead(END_STOP_RIGHT) == LOW) { | ||
+ | digitalWrite(DIRECTION_SIGNAL, | ||
+ | step(); | ||
+ | if (digitalRead(END_STOP_RIGHT) == HIGH) { | ||
+ | digitalWrite(DIRECTION_SIGNAL, | ||
+ | STEP_COUNTER = 0; | ||
+ | while (STEP_COUNTER <= MOVE_STEP_FROM_SWITCH) { | ||
+ | step(); | ||
+ | } | ||
+ | STATE = 3; | ||
+ | } | ||
+ | break; | ||
+ | } | ||
+ | break; | ||
+ | |||
+ | case 3: //Indicates with a LED that the Slider is ready with taking photos | ||
+ | while(1) { | ||
+ | digitalWrite(LED_INDICATOR = HIGH); | ||
+ | delay(200); | ||
+ | digitalWrite(LED_INDICATOR = LOW); | ||
+ | delay(200); | ||
+ | | ||
+ | } | ||
+ | |||
+ | | ||
+ | } | ||
+ | } | ||
</ | </ |
projekte/kameraslider.txt · Zuletzt geändert: 2021/01/17 20:19 von thorsten