/* * AutoPano1D, arduino sketch to take panorama photo driving a stepper motor and a wireless shutter * Copyright (C) 2018 Ludovic Pouzenc * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ // Tested on an Arduino Nano with IDE 1.8.5 #include #define SERIAL_TRACE Serial.println(__FUNCTION__) // Config const int pictureCount = 12; const int motorStepsPerRevolution = 200; const int cameraStepsPerRevolution = 1000; // include external mechanic ratio const int motorSpeed = 30; // rpm const int cameraStabilizeDelay = 1000; // ms const int cameraTakeDelay = 2000; // ms // Pinout const int buttonPin = 2; const int shutterPin = 12; Stepper myStepper(motorSpeed, 8, 9, 10, 11); void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); pinMode(shutterPin, INPUT); // Yes high-Z first, see takePic() myStepper.setSpeed(motorSpeed); Serial.begin(9600); // bauds ack(); } void ack() { SERIAL_TRACE; digitalWrite(LED_BUILTIN, HIGH); delay(100); digitalWrite(LED_BUILTIN, LOW); } void loop() { if ( digitalRead(buttonPin) == LOW) { ack(); takePano(); ack(); } } void takePano() { SERIAL_TRACE; for ( int i=0; i