diff --git a/components/Optocoupler CNY17.pdf b/components/Optocoupler CNY17.pdf new file mode 100644 index 0000000..06eecbe Binary files /dev/null and b/components/Optocoupler CNY17.pdf differ diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.cpp b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.cpp new file mode 100644 index 0000000..da5b3b2 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.cpp @@ -0,0 +1,350 @@ +// AccelStepper.cpp +// +// Copyright (C) 2009 Mike McCauley +// $Id: AccelStepper.cpp,v 1.2 2010/10/24 07:46:18 mikem Exp mikem $ + +#include "AccelStepper.h" + +void AccelStepper::moveTo(long absolute) +{ + _targetPos = absolute; + computeNewSpeed(); +} + +void AccelStepper::move(long relative) +{ + moveTo(_currentPos + relative); +} + +// Implements steps according to the current speed +// You must call this at least once per step +// returns true if a step occurred +boolean AccelStepper::runSpeed() +{ + unsigned long time = millis(); + + if (time > _lastStepTime + _stepInterval) + { + if (_speed > 0) + { + // Clockwise + _currentPos += 1; + } + else if (_speed < 0) + { + // Anticlockwise + _currentPos -= 1; + } + step(_currentPos & 0x3); // Bottom 2 bits (same as mod 4, but works with + and - numbers) + + _lastStepTime = time; + return true; + } + else + return false; +} + +long AccelStepper::distanceToGo() +{ + return _targetPos - _currentPos; +} + +long AccelStepper::targetPosition() +{ + return _targetPos; +} + +long AccelStepper::currentPosition() +{ + return _currentPos; +} + +// Useful during initialisations or after initial positioning +void AccelStepper::setCurrentPosition(long position) +{ + _currentPos = position; +} + +void AccelStepper::computeNewSpeed() +{ + setSpeed(desiredSpeed()); +} + +// Work out and return a new speed. +// Subclasses can override if they want +// Implement acceleration, deceleration and max speed +// Negative speed is anticlockwise +// This is called: +// after each step +// after user changes: +// maxSpeed +// acceleration +// target position (relative or absolute) +float AccelStepper::desiredSpeed() +{ + long distanceTo = distanceToGo(); + + // Max possible speed that can still decelerate in the available distance + float requiredSpeed; + if (distanceTo == 0) + return 0.0; // Were there + else if (distanceTo > 0) // Clockwise + requiredSpeed = sqrt(2.0 * distanceTo * _acceleration); + else // Anticlockwise + requiredSpeed = -sqrt(2.0 * -distanceTo * _acceleration); + + if (requiredSpeed > _speed) + { + // Need to accelerate in clockwise direction + if (_speed == 0) + requiredSpeed = sqrt(2.0 * _acceleration); + else + requiredSpeed = _speed + abs(_acceleration / _speed); + if (requiredSpeed > _maxSpeed) + requiredSpeed = _maxSpeed; + } + else if (requiredSpeed < _speed) + { + // Need to accelerate in anticlockwise direction + if (_speed == 0) + requiredSpeed = -sqrt(2.0 * _acceleration); + else + requiredSpeed = _speed - abs(_acceleration / _speed); + if (requiredSpeed < -_maxSpeed) + requiredSpeed = -_maxSpeed; + } +// Serial.println(requiredSpeed); + return requiredSpeed; +} + +// Run the motor to implement speed and acceleration in order to proceed to the target position +// You must call this at least once per step, preferably in your main loop +// If the motor is in the desired position, the cost is very small +// returns true if we are still running to position +boolean AccelStepper::run() +{ + if (_targetPos == _currentPos) + return false; + + if (runSpeed()) + computeNewSpeed(); + return true; +} + +AccelStepper::AccelStepper(uint8_t pins, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4) +{ + _pins = pins; + _currentPos = 0; + _targetPos = 0; + _speed = 0.0; + _maxSpeed = 1.0; + _acceleration = 1.0; + _stepInterval = 0; + _lastStepTime = 0; + _pin1 = pin1; + _pin2 = pin2; + _pin3 = pin3; + _pin4 = pin4; + enableOutputs(); +} + +AccelStepper::AccelStepper(void (*forward)(), void (*backward)()) +{ + _pins = 0; + _currentPos = 0; + _targetPos = 0; + _speed = 0.0; + _maxSpeed = 1.0; + _acceleration = 1.0; + _stepInterval = 0; + _lastStepTime = 0; + _pin1 = 0; + _pin2 = 0; + _pin3 = 0; + _pin4 = 0; + _forward = forward; + _backward = backward; +} + +void AccelStepper::setMaxSpeed(float speed) +{ + _maxSpeed = speed; + computeNewSpeed(); +} + +void AccelStepper::setAcceleration(float acceleration) +{ + _acceleration = acceleration; + computeNewSpeed(); +} + +void AccelStepper::setSpeed(float speed) +{ + _speed = speed; + _stepInterval = abs(1000.0 / _speed); +} + +float AccelStepper::speed() +{ + return _speed; +} + +// Subclasses can override +void AccelStepper::step(uint8_t step) +{ + switch (_pins) + { + case 0: + step0(); + break; + case 1: + step1(step); + break; + + case 2: + step2(step); + break; + + case 4: + step4(step); + break; + } +} + +// 0 pin step function (ie for functional usage) +void AccelStepper::step0() +{ + if (_speed > 0) { + _forward(); + } else { + _backward(); + } +} + +// 1 pin step function (ie for stepper drivers) +// This is passed the current step number (0 to 3) +// Subclasses can override +void AccelStepper::step1(uint8_t step) +{ + digitalWrite(_pin2, _speed > 0); // Direction + // Caution 200ns setup time + digitalWrite(_pin1, HIGH); + // Caution, min Step pulse width for 3967 is 1microsec + // Delay 1microsec + delayMicroseconds(1); + digitalWrite(_pin1, LOW); +} + +// 2 pin step function +// This is passed the current step number (0 to 3) +// Subclasses can override +void AccelStepper::step2(uint8_t step) +{ + switch (step) + { + case 0: /* 01 */ + digitalWrite(_pin1, LOW); + digitalWrite(_pin2, HIGH); + break; + + case 1: /* 11 */ + digitalWrite(_pin1, HIGH); + digitalWrite(_pin2, HIGH); + break; + + case 2: /* 10 */ + digitalWrite(_pin1, HIGH); + digitalWrite(_pin2, LOW); + break; + + case 3: /* 00 */ + digitalWrite(_pin1, LOW); + digitalWrite(_pin2, LOW); + break; + } +} + +// 4 pin step function +// This is passed the current step number (0 to 3) +// Subclasses can override +void AccelStepper::step4(uint8_t step) +{ + switch (step) + { + case 0: // 1010 + digitalWrite(_pin1, HIGH); + digitalWrite(_pin2, LOW); + digitalWrite(_pin3, HIGH); + digitalWrite(_pin4, LOW); + break; + + case 1: // 0110 + digitalWrite(_pin1, LOW); + digitalWrite(_pin2, HIGH); + digitalWrite(_pin3, HIGH); + digitalWrite(_pin4, LOW); + break; + + case 2: //0101 + digitalWrite(_pin1, LOW); + digitalWrite(_pin2, HIGH); + digitalWrite(_pin3, LOW); + digitalWrite(_pin4, HIGH); + break; + + case 3: //1001 + digitalWrite(_pin1, HIGH); + digitalWrite(_pin2, LOW); + digitalWrite(_pin3, LOW); + digitalWrite(_pin4, HIGH); + break; + } +} + + +// Prevents power consumption on the outputs +void AccelStepper::disableOutputs() +{ + if (! _pins) return; + + digitalWrite(_pin1, LOW); + digitalWrite(_pin2, LOW); + if (_pins == 4) + { + digitalWrite(_pin3, LOW); + digitalWrite(_pin4, LOW); + } +} + +void AccelStepper::enableOutputs() +{ + if (! _pins) return; + + pinMode(_pin1, OUTPUT); + pinMode(_pin2, OUTPUT); + if (_pins == 4) + { + pinMode(_pin3, OUTPUT); + pinMode(_pin4, OUTPUT); + } +} + +// Blocks until the target position is reached +void AccelStepper::runToPosition() +{ + while (run()) + ; +} + +boolean AccelStepper::runSpeedToPosition() +{ + return _targetPos!=_currentPos ? AccelStepper::runSpeed() : false; +} + +// Blocks until the new target position is reached +void AccelStepper::runToNewPosition(long position) +{ + moveTo(position); + runToPosition(); +} + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.h b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.h new file mode 100644 index 0000000..a7906e8 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/AccelStepper.h @@ -0,0 +1,339 @@ +// AccelStepper.h +// +/// \mainpage AccelStepper library for Arduino +/// +/// This is the Arduino AccelStepper 1.2 library. +/// It provides an object-oriented interface for 2 or 4 pin stepper motors. +/// +/// The standard Arduino IDE includes the Stepper library +/// (http://arduino.cc/en/Reference/Stepper) for stepper motors. It is +/// perfectly adequate for simple, single motor applications. +/// +/// AccelStepper significantly improves on the standard Arduino Stepper library in several ways: +/// \li Supports acceleration and deceleration +/// \li Supports multiple simultaneous steppers, with independent concurrent stepping on each stepper +/// \li API functions never delay() or block +/// \li Supports 2 and 4 wire steppers +/// \li Supports stepper drivers such as the Sparkfun EasyDriver (based on 3967 driver chip) +/// \li Very slow speeds are supported +/// \li Extensive API +/// \li Subclass support +/// +/// The latest version of this documentation can be downloaded from +/// http://www.open.com.au/mikem/arduino/AccelStepper +/// +/// Example Arduino programs are included to show the main modes of use. +/// +/// The version of the package that this documentation refers to can be downloaded +/// from http://www.open.com.au/mikem/arduino/AccelStepper/AccelStepper-1.3.zip +/// You can find the latest version at http://www.open.com.au/mikem/arduino/AccelStepper +/// +/// Tested on Arduino Diecimila and Mega with arduino-0018 on OpenSuSE 11.1 and avr-libc-1.6.1-1.15, +/// cross-avr-binutils-2.19-9.1, cross-avr-gcc-4.1.3_20080612-26.5. +/// +/// \par Installation +/// Install in the usual way: unzip the distribution zip file to the libraries +/// sub-folder of your sketchbook. +/// +/// This software is Copyright (C) 2010 Mike McCauley. Use is subject to license +/// conditions. The main licensing options available are GPL V2 or Commercial: +/// +/// \par Open Source Licensing GPL V2 +/// This is the appropriate option if you want to share the source code of your +/// application with everyone you distribute it to, and you also want to give them +/// the right to share who uses it. If you wish to use this software under Open +/// Source Licensing, you must contribute all your source code to the open source +/// community in accordance with the GPL Version 2 when your application is +/// distributed. See http://www.gnu.org/copyleft/gpl.html +/// +/// \par Commercial Licensing +/// This is the appropriate option if you are creating proprietary applications +/// and you are not prepared to distribute and share the source code of your +/// application. Contact info@open.com.au for details. +/// +/// \par Revision History +/// \version 1.0 Initial release +/// +/// \version 1.1 Added speed() function to get the current speed. +/// \version 1.2 Added runSpeedToPosition() submitted by Gunnar Arndt. +/// \version 1.3 Added support for stepper drivers (ie with Step and Direction inputs) with _pins == 1 +/// +/// +/// \author Mike McCauley (mikem@open.com.au) +// Copyright (C) 2009 Mike McCauley +// $Id: AccelStepper.h,v 1.2 2010/10/24 07:46:18 mikem Exp mikem $ + +#ifndef AccelStepper_h +#define AccelStepper_h + +#if ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" + #include "stdlib.h" + #include "wiring.h" +#endif + + +// These defs cause trouble on some versions of Arduino +#undef round + +///////////////////////////////////////////////////////////////////// +/// \class AccelStepper AccelStepper.h +/// \brief Support for stepper motors with acceleration etc. +/// +/// This defines a single 2 or 4 pin stepper motor, or stepper moter with fdriver chip, with optional +/// acceleration, deceleration, absolute positioning commands etc. Multiple +/// simultaneous steppers are supported, all moving +/// at different speeds and accelerations. +/// +/// \par Operation +/// This module operates by computing a step time in milliseconds. The step +/// time is recomputed after each step and after speed and acceleration +/// parameters are changed by the caller. The time of each step is recorded in +/// milliseconds. The run() function steps the motor if a new step is due. +/// The run() function must be called frequently until the motor is in the +/// desired position, after which time run() will do nothing. +/// +/// \par Positioning +/// Positions are specified by a signed long integer. At +/// construction time, the current position of the motor is consider to be 0. Positive +/// positions are clockwise from the initial position; negative positions are +/// anticlockwise. The curent position can be altered for instance after +/// initialization positioning. +/// +/// \par Caveats +/// This is an open loop controller: If the motor stalls or is oversped, +/// AccelStepper will not have a correct +/// idea of where the motor really is (since there is no feedback of the motor's +/// real position. We only know where we _think_ it is, relative to the +/// initial starting point). +/// +/// The fastest motor speed that can be reliably supported is 1000 steps per +/// second (1 step every millisecond). However any speed less than that down +/// to very slow speeds (much less than one per second) are supported, +/// provided the run() function is called frequently enough to step the +/// motor whenever required. +class AccelStepper +{ +public: + /// Constructor. You can have multiple simultaneous steppers, all moving + /// at different speeds and accelerations, provided you call their run() + /// functions at frequent enough intervals. Current Position is set to 0, target + /// position is set to 0. MaxSpeed and Acceleration default to 1.0. + /// The motor pins will be initialised to OUTPUT mode during the + /// constructor by a call to enableOutputs(). + /// \param[in] pins Number of pins to interface to. 1, 2 or 4 are + /// supported. 1 means a stepper driver (with Step and Direction pins) + /// 2 means a 2 wire stepper. 4 means a 4 wire stepper. + /// Defaults to 4 pins. + /// \param[in] pin1 Arduino digital pin number for motor pin 1. Defaults + /// to pin 2. For a driver (pins==1), this is the Step input to the driver. Low to high transition means to step) + /// \param[in] pin2 Arduino digital pin number for motor pin 2. Defaults + /// to pin 3. For a driver (pins==1), this is the Direction input the driver. High means forward. + /// \param[in] pin3 Arduino digital pin number for motor pin 3. Defaults + /// to pin 4. + /// \param[in] pin4 Arduino digital pin number for motor pin 4. Defaults + /// to pin 5. + AccelStepper(uint8_t pins = 4, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5); + + /// Constructor. You can have multiple simultaneous steppers, all moving + /// at different speeds and accelerations, provided you call their run() + /// functions at frequent enough intervals. Current Position is set to 0, target + /// position is set to 0. MaxSpeed and Acceleration default to 1.0. + /// Any motor initialization should happen before hand, no pins are used or initialized. + /// \param[in] forward void-returning procedure that will make a forward step + /// \param[in] backward void-returning procedure that will make a backward step + AccelStepper(void (*forward)(), void (*backward)()); + + /// Set the target position. The run() function will try to move the motor + /// from the current position to the target position set by the most + /// recent call to this function. + /// \param[in] absolute The desired absolute position. Negative is + /// anticlockwise from the 0 position. + void moveTo(long absolute); + + /// Set the target position relative to the current position + /// \param[in] relative The desired position relative to the current position. Negative is + /// anticlockwise from the current position. + void move(long relative); + + /// Poll the motor and step it if a step is due, implementing + /// accelerations and decelerations to achive the ratget position. You must call this as + /// fequently as possible, but at least once per minimum step interval, + /// preferably in your main loop. + /// \return true if the motor is at the target position. + boolean run(); + + /// Poll the motor and step it if a step is due, implmenting a constant + /// speed as set by the most recent call to setSpeed(). + /// \return true if the motor was stepped. + boolean runSpeed(); + + /// Sets the maximum permitted speed. the run() function will accelerate + /// up to the speed set by this function. + /// \param[in] speed The desired maximum speed in steps per second. Must + /// be > 0. Speeds of more than 1000 steps per second are unreliable. + void setMaxSpeed(float speed); + + /// Sets the acceleration and deceleration parameter. + /// \param[in] acceleration The desired acceleration in steps per second + /// per second. Must be > 0. + void setAcceleration(float acceleration); + + /// Sets the desired constant speed for use with runSpeed(). + /// \param[in] speed The desired constant speed in steps per + /// second. Positive is clockwise. Speeds of more than 1000 steps per + /// second are unreliable. Very slow speeds may be set (eg 0.00027777 for + /// once per hour, approximately. Speed accuracy depends on the Arduino + /// crystal. Jitter depends on how frequently you call the runSpeed() function. + void setSpeed(float speed); + + /// The most recently set speed + /// \return the most recent speed in steps per second + float speed(); + + /// The distance from the current position to the target position. + /// \return the distance from the current position to the target position + /// in steps. Positive is clockwise from the current position. + long distanceToGo(); + + /// The most recently set target position. + /// \return the target position + /// in steps. Positive is clockwise from the 0 position. + long targetPosition(); + + + /// The currently motor position. + /// \return the current motor position + /// in steps. Positive is clockwise from the 0 position. + long currentPosition(); + + /// Resets the current position of the motor, so that wherever the mottor + /// happens to be right now is considered to be the new position. Useful + /// for setting a zero position on a stepper after an initial hardware + /// positioning move. + /// \param[in] position The position in steps of wherever the motor + /// happens to be right now. + void setCurrentPosition(long position); + + /// Moves the motor to the target position and blocks until it is at + /// position. Dont use this in event loops, since it blocks. + void runToPosition(); + + /// Runs at the currently selected speed until the target position is reached + /// Does not implement accelerations. + boolean runSpeedToPosition(); + + /// Moves the motor to the new target position and blocks until it is at + /// position. Dont use this in event loops, since it blocks. + /// \param[in] position The new target position. + void runToNewPosition(long position); + + /// Disable motor pin outputs by setting them all LOW + /// Depending on the design of your electronics this may turn off + /// the power to the motor coils, saving power. + /// This is useful to support Arduino low power modes: disable the outputs + /// during sleep and then reenable with enableOutputs() before stepping + /// again. + void disableOutputs(); + + /// Enable motor pin outputs by setting the motor pins to OUTPUT + /// mode. Called automatically by the constructor. + void enableOutputs(); + +protected: + + /// Forces the library to compute a new instantaneous speed and set that as + /// the current speed. Calls + /// desiredSpeed(), which can be overridden by subclasses. It is called by + /// the library: + /// \li after each step + /// \li after change to maxSpeed through setMaxSpeed() + /// \li after change to acceleration through setAcceleration() + /// \li after change to target position (relative or absolute) through + /// move() or moveTo() + void computeNewSpeed(); + + /// Called to execute a step. Only called when a new step is + /// required. Subclasses may override to implement new stepping + /// interfaces. The default calls step1(), step2() or step4() depending on the + /// number of pins defined for the stepper. + /// \param[in] step The current step phase number (0 to 3) + virtual void step(uint8_t step); + + /// Called to execute a step using stepper functions (pins = 0) Only called when a new step is + /// required. Calls _forward() or _backward() to perform the step + virtual void step0(void); + + /// Called to execute a step on a stepper drover (ie where pins == 1). Only called when a new step is + /// required. Subclasses may override to implement new stepping + /// interfaces. The default sets or clears the outputs of Step pin1 to step, + /// and sets the output of _pin2 to the desired direction. The Step pin (_pin1) is pulsed for 1 microsecond + /// which is the minimum STEP pulse width for the 3967 driver. + /// \param[in] step The current step phase number (0 to 3) + virtual void step1(uint8_t step); + + /// Called to execute a step on a 2 pin motor. Only called when a new step is + /// required. Subclasses may override to implement new stepping + /// interfaces. The default sets or clears the outputs of pin1 and pin2 + /// \param[in] step The current step phase number (0 to 3) + virtual void step2(uint8_t step); + + /// Called to execute a step on a 4 pin motor. Only called when a new step is + /// required. Subclasses may override to implement new stepping + /// interfaces. The default sets or clears the outputs of pin1, pin2, + /// pin3, pin4. + /// \param[in] step The current step phase number (0 to 3) + virtual void step4(uint8_t step); + + /// Compute and return the desired speed. The default algorithm uses + /// maxSpeed, acceleration and the current speed to set a new speed to + /// move the motor from teh current position to the target + /// position. Subclasses may override this to provide an alternate + /// algorithm (but do not block). Called by computeNewSpeed whenever a new speed neds to be + /// computed. + virtual float desiredSpeed(); + +private: + /// Number of pins on the stepper motor. Permits 2 or 4. 2 pins is a + /// bipolar, and 4 pins is a unipolar. + uint8_t _pins; // 2 or 4 + + /// Arduino pin number for the 2 or 4 pins required to interface to the + /// stepper motor. + uint8_t _pin1, _pin2, _pin3, _pin4; + + /// The current absolution position in steps. + long _currentPos; // Steps + + /// The target position in steps. The AccelStepper library will move the + /// motor from teh _currentPos to the _targetPos, taking into account the + /// max speed, acceleration and deceleration + long _targetPos; // Steps + + /// The current motos speed in steps per second + /// Positive is clockwise + float _speed; // Steps per second + + /// The maximum permitted speed in steps per second. Must be > 0. + float _maxSpeed; + + /// The acceleration to use to accelerate or decelerate the motor in steps + /// per second per second. Must be > 0 + float _acceleration; + + /// The current interval between steps in milliseconds. + unsigned long _stepInterval; + + /// The last step time in milliseconds + unsigned long _lastStepTime; + + // The pointer to a forward-step procedure + void (*_forward)(); + + // The pointer to a backward-step procedure + void (*_backward)(); +}; + +#endif diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/LICENSE b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/LICENSE new file mode 100644 index 0000000..da124e1 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/LICENSE @@ -0,0 +1,17 @@ +This software is Copyright (C) 2008 Mike McCauley. Use is subject to license +conditions. The main licensing options available are GPL V2 or Commercial: + +Open Source Licensing GPL V2 + +This is the appropriate option if you want to share the source code of your +application with everyone you distribute it to, and you also want to give them +the right to share who uses it. If you wish to use this software under Open +Source Licensing, you must contribute all your source code to the open source +community in accordance with the GPL Version 2 when your application is +distributed. See http://www.gnu.org/copyleft/gpl.html + +Commercial Licensing + +This is the appropriate option if you are creating proprietary applications +and you are not prepared to distribute and share the source code of your +application. Contact info@open.com.au for details. diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/MANIFEST b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/MANIFEST new file mode 100644 index 0000000..8835e18 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/MANIFEST @@ -0,0 +1,27 @@ +AccelStepper/Makefile +AccelStepper/AccelStepper.h +AccelStepper/AccelStepper.cpp +AccelStepper/MANIFEST +AccelStepper/LICENSE +AccelStepper/project.cfg +AccelStepper/doc +AccelStepper/examples/Blocking/Blocking.pde +AccelStepper/examples/MultiStepper/MultiStepper.pde +AccelStepper/examples/Overshoot/Overshoot.pde +AccelStepper/examples/ConstantSpeed/ConstantSpeed.pde +AccelStepper/examples/Random/Random.pde +AccelStepper/doc +AccelStepper/doc/index.html +AccelStepper/doc/functions.html +AccelStepper/doc/annotated.html +AccelStepper/doc/tab_l.gif +AccelStepper/doc/tabs.css +AccelStepper/doc/files.html +AccelStepper/doc/classAccelStepper-members.html +AccelStepper/doc/doxygen.css +AccelStepper/doc/AccelStepper_8h-source.html +AccelStepper/doc/tab_r.gif +AccelStepper/doc/doxygen.png +AccelStepper/doc/tab_b.gif +AccelStepper/doc/functions_func.html +AccelStepper/doc/classAccelStepper.html diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/Makefile b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/Makefile new file mode 100644 index 0000000..cb3f65d --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/Makefile @@ -0,0 +1,26 @@ +# Makefile +# +# Makefile for the Arduino AccelStepper project +# +# Author: Mike McCauley (mikem@open.com.au) +# Copyright (C) 2010 Mike McCauley +# $Id: Makefile,v 1.1 2010/04/25 02:21:18 mikem Exp mikem $ + +PROJNAME = AccelStepper +# Dont forget to also change the version at the top of AccelStepper.h: +DISTFILE = $(PROJNAME)-1.3.zip + +all: doxygen dist upload + +doxygen: + doxygen project.cfg + + +ci: + ci -l `cat MANIFEST` + +dist: + (cd ..; zip $(PROJNAME)/$(DISTFILE) `cat $(PROJNAME)/MANIFEST`) + +upload: + scp $(DISTFILE) doc/*.html doc/*.gif doc/*.png doc/*.css doc/*.pdf server2:/var/www/html/mikem/arduino/$(PROJNAME) diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/README.txt b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/README.txt new file mode 100644 index 0000000..0e5b45f --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/README.txt @@ -0,0 +1 @@ +TO INSTALL: Download zip by clicking "DOWNLOADS" in top right corner. Then uncompress folder and rename to AccelStepper. Make sure that folder contains this README. Then copy to sketchfolder/libraries (see also http://www.ladyada.net/library/arduino/libraries.html) \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/AccelStepper_8h-source.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/AccelStepper_8h-source.html new file mode 100644 index 0000000..2c0c25d --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/AccelStepper_8h-source.html @@ -0,0 +1,336 @@ + + +AccelStepper: AccelStepper.h Source File + + + + + +
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/annotated.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/annotated.html new file mode 100644 index 0000000..18e809b --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/annotated.html @@ -0,0 +1,32 @@ + + +AccelStepper: Class List + + + + + +
+

Class List

Here are the classes, structs, unions and interfaces with brief descriptions: + +
AccelStepperSupport for stepper motors with acceleration etc
+
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper-members.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper-members.html new file mode 100644 index 0000000..471ce2f --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper-members.html @@ -0,0 +1,54 @@ + + +AccelStepper: Member List + + + + + +
+

AccelStepper Member List

This is the complete list of members for AccelStepper, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + +
AccelStepper(uint8_t pins=4, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5)AccelStepper
computeNewSpeed()AccelStepper [protected]
currentPosition()AccelStepper
desiredSpeed()AccelStepper [protected, virtual]
disableOutputs()AccelStepper
distanceToGo()AccelStepper
enableOutputs()AccelStepper
move(long relative)AccelStepper
moveTo(long absolute)AccelStepper
run()AccelStepper
runSpeed()AccelStepper
runSpeedToPosition()AccelStepper
runToNewPosition(long position)AccelStepper
runToPosition()AccelStepper
setAcceleration(float acceleration)AccelStepper
setCurrentPosition(long position)AccelStepper
setMaxSpeed(float speed)AccelStepper
setSpeed(float speed)AccelStepper
speed()AccelStepper
step(uint8_t step)AccelStepper [protected, virtual]
step1(uint8_t step)AccelStepper [protected, virtual]
step2(uint8_t step)AccelStepper [protected, virtual]
step4(uint8_t step)AccelStepper [protected, virtual]
targetPosition()AccelStepper

+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper.html new file mode 100644 index 0000000..fb17ffc --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/classAccelStepper.html @@ -0,0 +1,723 @@ + + +AccelStepper: AccelStepper Class Reference + + + + + +
+

AccelStepper Class Reference

Support for stepper motors with acceleration etc. +More... +

+#include <AccelStepper.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 AccelStepper (uint8_t pins=4, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5)
void moveTo (long absolute)
void move (long relative)
boolean run ()
boolean runSpeed ()
void setMaxSpeed (float speed)
void setAcceleration (float acceleration)
void setSpeed (float speed)
float speed ()
long distanceToGo ()
long targetPosition ()
long currentPosition ()
void setCurrentPosition (long position)
void runToPosition ()
boolean runSpeedToPosition ()
void runToNewPosition (long position)
void disableOutputs ()
void enableOutputs ()

Protected Member Functions

void computeNewSpeed ()
virtual void step (uint8_t step)
virtual void step1 (uint8_t step)
virtual void step2 (uint8_t step)
virtual void step4 (uint8_t step)
virtual float desiredSpeed ()
+


Detailed Description

+Support for stepper motors with acceleration etc. +

+This defines a single 2 or 4 pin stepper motor, or stepper moter with fdriver chip, with optional acceleration, deceleration, absolute positioning commands etc. Multiple simultaneous steppers are supported, all moving at different speeds and accelerations.

+

Operation
This module operates by computing a step time in milliseconds. The step time is recomputed after each step and after speed and acceleration parameters are changed by the caller. The time of each step is recorded in milliseconds. The run() function steps the motor if a new step is due. The run() function must be called frequently until the motor is in the desired position, after which time run() will do nothing.
+
Positioning
Positions are specified by a signed long integer. At construction time, the current position of the motor is consider to be 0. Positive positions are clockwise from the initial position; negative positions are anticlockwise. The curent position can be altered for instance after initialization positioning.
+
Caveats
This is an open loop controller: If the motor stalls or is oversped, AccelStepper will not have a correct idea of where the motor really is (since there is no feedback of the motor's real position. We only know where we _think_ it is, relative to the initial starting point).
+The fastest motor speed that can be reliably supported is 1000 steps per second (1 step every millisecond). However any speed less than that down to very slow speeds (much less than one per second) are supported, provided the run() function is called frequently enough to step the motor whenever required.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AccelStepper::AccelStepper (uint8_t  pins = 4,
uint8_t  pin1 = 2,
uint8_t  pin2 = 3,
uint8_t  pin3 = 4,
uint8_t  pin4 = 5 
)
+
+
+ +

+Constructor. You can have multiple simultaneous steppers, all moving at different speeds and accelerations, provided you call their run() functions at frequent enough intervals. Current Position is set to 0, target position is set to 0. MaxSpeed and Acceleration default to 1.0. The motor pins will be initialised to OUTPUT mode during the constructor by a call to enableOutputs().

Parameters:
+ + + + + + +
[in] pins Number of pins to interface to. 1, 2 or 4 are supported. 1 means a stepper driver (with Step and Direction pins) 2 means a 2 wire stepper. 4 means a 4 wire stepper. Defaults to 4 pins.
[in] pin1 Arduino digital pin number for motor pin 1. Defaults to pin 2. For a driver (pins==1), this is the Step input to the driver. Low to high transition means to step)
[in] pin2 Arduino digital pin number for motor pin 2. Defaults to pin 3. For a driver (pins==1), this is the Direction input the driver. High means forward.
[in] pin3 Arduino digital pin number for motor pin 3. Defaults to pin 4.
[in] pin4 Arduino digital pin number for motor pin 4. Defaults to pin 5.
+
+ +

References enableOutputs().

+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
void AccelStepper::moveTo (long  absolute  ) 
+
+
+ +

+Set the target position. The run() function will try to move the motor from the current position to the target position set by the most recent call to this function.

Parameters:
+ + +
[in] absolute The desired absolute position. Negative is anticlockwise from the 0 position.
+
+ +

References computeNewSpeed().

+ +

Referenced by move(), and runToNewPosition().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::move (long  relative  ) 
+
+
+ +

+Set the target position relative to the current position

Parameters:
+ + +
[in] relative The desired position relative to the current position. Negative is anticlockwise from the current position.
+
+ +

References moveTo().

+ +
+

+ +

+
+ + + + + + + + +
boolean AccelStepper::run (  ) 
+
+
+ +

+Poll the motor and step it if a step is due, implementing accelerations and decelerations to achive the ratget position. You must call this as fequently as possible, but at least once per minimum step interval, preferably in your main loop.

Returns:
true if the motor is at the target position.
+ +

References computeNewSpeed(), and runSpeed().

+ +

Referenced by runToPosition().

+ +
+

+ +

+
+ + + + + + + + +
boolean AccelStepper::runSpeed (  ) 
+
+
+ +

+Poll the motor and step it if a step is due, implmenting a constant speed as set by the most recent call to setSpeed().

Returns:
true if the motor was stepped.
+ +

References step().

+ +

Referenced by run(), and runSpeedToPosition().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::setMaxSpeed (float  speed  ) 
+
+
+ +

+Sets the maximum permitted speed. the run() function will accelerate up to the speed set by this function.

Parameters:
+ + +
[in] speed The desired maximum speed in steps per second. Must be > 0. Speeds of more than 1000 steps per second are unreliable.
+
+ +

References computeNewSpeed().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::setAcceleration (float  acceleration  ) 
+
+
+ +

+Sets the acceleration and deceleration parameter.

Parameters:
+ + +
[in] acceleration The desired acceleration in steps per second per second. Must be > 0.
+
+ +

References computeNewSpeed().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::setSpeed (float  speed  ) 
+
+
+ +

+Sets the desired constant speed for use with runSpeed().

Parameters:
+ + +
[in] speed The desired constant speed in steps per second. Positive is clockwise. Speeds of more than 1000 steps per second are unreliable. Very slow speeds may be set (eg 0.00027777 for once per hour, approximately. Speed accuracy depends on the Arduino crystal. Jitter depends on how frequently you call the runSpeed() function.
+
+ +

Referenced by computeNewSpeed().

+ +
+

+ +

+
+ + + + + + + + +
float AccelStepper::speed (  ) 
+
+
+ +

+The most recently set speed

Returns:
the most recent speed in steps per second
+ +
+

+ +

+
+ + + + + + + + +
long AccelStepper::distanceToGo (  ) 
+
+
+ +

+The distance from the current position to the target position.

Returns:
the distance from the current position to the target position in steps. Positive is clockwise from the current position.
+ +

Referenced by desiredSpeed().

+ +
+

+ +

+
+ + + + + + + + +
long AccelStepper::targetPosition (  ) 
+
+
+ +

+The most recently set target position.

Returns:
the target position in steps. Positive is clockwise from the 0 position.
+ +
+

+ +

+
+ + + + + + + + +
long AccelStepper::currentPosition (  ) 
+
+
+ +

+The currently motor position.

Returns:
the current motor position in steps. Positive is clockwise from the 0 position.
+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::setCurrentPosition (long  position  ) 
+
+
+ +

+Resets the current position of the motor, so that wherever the mottor happens to be right now is considered to be the new position. Useful for setting a zero position on a stepper after an initial hardware positioning move.

Parameters:
+ + +
[in] position The position in steps of wherever the motor happens to be right now.
+
+ +
+

+ +

+
+ + + + + + + + +
void AccelStepper::runToPosition (  ) 
+
+
+ +

+Moves the motor to the target position and blocks until it is at position. Dont use this in event loops, since it blocks. +

References run().

+ +

Referenced by runToNewPosition().

+ +
+

+ +

+
+ + + + + + + + +
boolean AccelStepper::runSpeedToPosition (  ) 
+
+
+ +

+Runs at the currently selected speed until the target position is reached Does not implement accelerations. +

References runSpeed().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::runToNewPosition (long  position  ) 
+
+
+ +

+Moves the motor to the new target position and blocks until it is at position. Dont use this in event loops, since it blocks.

Parameters:
+ + +
[in] position The new target position.
+
+ +

References moveTo(), and runToPosition().

+ +
+

+ +

+
+ + + + + + + + +
void AccelStepper::disableOutputs (  ) 
+
+
+ +

+Disable motor pin outputs by setting them all LOW Depending on the design of your electronics this may turn off the power to the motor coils, saving power. This is useful to support Arduino low power modes: disable the outputs during sleep and then reenable with enableOutputs() before stepping again. +

+

+ +

+
+ + + + + + + + +
void AccelStepper::enableOutputs (  ) 
+
+
+ +

+Enable motor pin outputs by setting the motor pins to OUTPUT mode. Called automatically by the constructor. +

Referenced by AccelStepper().

+ +
+

+ +

+
+ + + + + + + + +
void AccelStepper::computeNewSpeed (  )  [protected]
+
+
+ +

+Forces the library to compute a new instantaneous speed and set that as the current speed. Calls desiredSpeed(), which can be overridden by subclasses. It is called by the library:

+ +

References desiredSpeed(), and setSpeed().

+ +

Referenced by moveTo(), run(), setAcceleration(), and setMaxSpeed().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::step (uint8_t  step  )  [protected, virtual]
+
+
+ +

+Called to execute a step. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default calls step1(), step2() or step4() depending on the number of pins defined for the stepper.

Parameters:
+ + +
[in] step The current step phase number (0 to 3)
+
+ +

References step1(), step2(), and step4().

+ +

Referenced by runSpeed().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::step1 (uint8_t  step  )  [protected, virtual]
+
+
+ +

+Called to execute a step on a stepper drover (ie where pins == 1). Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of Step pin1 to step, and sets the output of _pin2 to the desired direction. The Step pin (_pin1) is pulsed for 1 microsecond which is the minimum STEP pulse width for the 3967 driver.

Parameters:
+ + +
[in] step The current step phase number (0 to 3)
+
+ +

Referenced by step().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::step2 (uint8_t  step  )  [protected, virtual]
+
+
+ +

+Called to execute a step on a 2 pin motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1 and pin2

Parameters:
+ + +
[in] step The current step phase number (0 to 3)
+
+ +

Referenced by step().

+ +
+

+ +

+
+ + + + + + + + + +
void AccelStepper::step4 (uint8_t  step  )  [protected, virtual]
+
+
+ +

+Called to execute a step on a 4 pin motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1, pin2, pin3, pin4.

Parameters:
+ + +
[in] step The current step phase number (0 to 3)
+
+ +

Referenced by step().

+ +
+

+ +

+
+ + + + + + + + +
float AccelStepper::desiredSpeed (  )  [protected, virtual]
+
+
+ +

+Compute and return the desired speed. The default algorithm uses maxSpeed, acceleration and the current speed to set a new speed to move the motor from teh current position to the target position. Subclasses may override this to provide an alternate algorithm (but do not block). Called by computeNewSpeed whenever a new speed neds to be computed. +

References distanceToGo().

+ +

Referenced by computeNewSpeed().

+ +
+

+


The documentation for this class was generated from the following files: +
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.css b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.css new file mode 100644 index 0000000..22c4843 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.css @@ -0,0 +1,473 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { + font-weight: bold +} +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navpath { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; + color: #ffffff +} +A.el { + text-decoration: none; + font-weight: bold +} +A.elRef { + font-weight: bold +} +A.code:link { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.code:visited { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.codeRef:link { + font-weight: normal; + color: #0000FF +} +A.codeRef:visited { + font-weight: normal; + color: #0000FF +} +A:hover { + text-decoration: none; + background-color: #f2f2ff +} +DL.el { + margin-left: -1cm +} +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { + text-align: center; +} +IMG.formulaDsp { +} +IMG.formulaInl { + vertical-align: middle; +} +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +SPAN.vhdldigit { color: #ff00ff } +SPAN.vhdlchar { color: #000000 } +SPAN.vhdlkeyword { color: #700070 } +SPAN.vhdllogic { color: #ff0000 } + +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { + font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { + background: #e8eef2; + font-weight: bold; +} +HR { + height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +/* these are for tree view when used as main index */ +.directory { + font-size: 9pt; + font-weight: bold; +} +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* The following two styles can be used to replace the root node title */ +/* with an image of your choice. Simply uncomment the next two styles, */ +/* specify the name of your image and be sure to set 'height' to the */ +/* proper pixel height of your image. */ + +/* .directory h3.swap { */ +/* height: 61px; */ +/* background-repeat: no-repeat; */ +/* background-image: url("yourimage.gif"); */ +/* } */ +/* .directory h3.swap span { */ +/* display: none; */ +/* } */ + +.directory > h3 { + margin-top: 0; +} +.directory p { + margin: 0px; + white-space: nowrap; +} +.directory div { + display: none; + margin: 0px; +} +.directory img { + vertical-align: -30%; +} +/* these are for tree view when not used as main index */ +.directory-alt { + font-size: 100%; + font-weight: bold; +} +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} +.directory-alt > h3 { + margin-top: 0; +} +.directory-alt p { + margin: 0px; + white-space: nowrap; +} +.directory-alt div { + display: none; + margin: 0px; +} +.directory-alt img { + vertical-align: -30%; +} + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.png b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.png new file mode 100644 index 0000000..f0a274b Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/doxygen.png differ diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/files.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/files.html new file mode 100644 index 0000000..87d95dd --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/files.html @@ -0,0 +1,26 @@ + + +AccelStepper: File Index + + + + + +
+

File List

Here is a list of all documented files with brief descriptions: + +
AccelStepper.h [code]
+
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions.html new file mode 100644 index 0000000..cffefb7 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions.html @@ -0,0 +1,87 @@ + + +AccelStepper: Class Members + + + + + +
+Here is a list of all documented class members with links to the class documentation for each member: +

+

+
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions_func.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions_func.html new file mode 100644 index 0000000..6e4d3fd --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/functions_func.html @@ -0,0 +1,87 @@ + + +AccelStepper: Class Members - Functions + + + + + +
+  +

+

+
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/index.html b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/index.html new file mode 100644 index 0000000..6391457 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/index.html @@ -0,0 +1,51 @@ + + +AccelStepper: AccelStepper library for Arduino + + + + + +
+

AccelStepper library for Arduino

+

+This is the Arduino AccelStepper 1.2 library. It provides an object-oriented interface for 2 or 4 pin stepper motors.

+The standard Arduino IDE includes the Stepper library (http://arduino.cc/en/Reference/Stepper) for stepper motors. It is perfectly adequate for simple, single motor applications.

+AccelStepper significantly improves on the standard Arduino Stepper library in several ways:

+The latest version of this documentation can be downloaded from http://www.open.com.au/mikem/arduino/AccelStepper

+Example Arduino programs are included to show the main modes of use.

+The version of the package that this documentation refers to can be downloaded from http://www.open.com.au/mikem/arduino/AccelStepper/AccelStepper-1.3.zip You can find the latest version at http://www.open.com.au/mikem/arduino/AccelStepper

+Tested on Arduino Diecimila and Mega with arduino-0018 on OpenSuSE 11.1 and avr-libc-1.6.1-1.15, cross-avr-binutils-2.19-9.1, cross-avr-gcc-4.1.3_20080612-26.5.

+

Installation
Install in the usual way: unzip the distribution zip file to the libraries sub-folder of your sketchbook.
+This software is Copyright (C) 2010 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V2 or Commercial:

+

Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 2 when your application is distributed. See http://www.gnu.org/copyleft/gpl.html
+
Commercial Licensing
This is the appropriate option if you are creating proprietary applications and you are not prepared to distribute and share the source code of your application. Contact info@open.com.au for details.
+
Revision History
+
Version:
1.0 Initial release

+1.1 Added speed() function to get the current speed.

+1.2 Added runSpeedToPosition() submitted by Gunnar Arndt.

+1.3 Added support for stepper drivers (ie with Step and Direction inputs) with _pins == 1

+
Author:
Mike McCauley (mikem@open.com.au)
+
+
Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by  + +doxygen 1.5.6
+ + diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_b.gif b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_b.gif new file mode 100644 index 0000000..0d62348 Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_b.gif differ diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_l.gif b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_l.gif new file mode 100644 index 0000000..9b1e633 Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_l.gif differ diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_r.gif b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_r.gif new file mode 100644 index 0000000..ce9dd9f Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tab_r.gif differ diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tabs.css b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tabs.css new file mode 100644 index 0000000..95f00a9 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/doc/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.navpath +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde new file mode 100644 index 0000000..523150f --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_ConstantSpeed/AFMotor_ConstantSpeed.pde @@ -0,0 +1,37 @@ +// ConstantSpeed.pde +// -*- mode: C++ -*- +// +// Shows how to run AccelStepper in the simplest, +// fixed speed mode with no accelerations +// Requires the AFMotor library (https://github.com/adafruit/Adafruit-Motor-Shield-library) +// And AccelStepper with AFMotor support (https://github.com/adafruit/AccelStepper) +// Public domain! + +#include +#include + +AF_Stepper motor1(200, 1); + + +// you can change these to DOUBLE or INTERLEAVE or MICROSTEP! +void forwardstep() { + motor1.onestep(FORWARD, SINGLE); +} +void backwardstep() { + motor1.onestep(BACKWARD, SINGLE); +} + +AccelStepper stepper(forwardstep, backwardstep); // use functions to step + +void setup() +{ + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("Stepper test!"); + + stepper.setSpeed(50); +} + +void loop() +{ + stepper.runSpeed(); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_MultiStepper/AFMotor_MultiStepper.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_MultiStepper/AFMotor_MultiStepper.pde new file mode 100644 index 0000000..d6db8b1 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/AFMotor_MultiStepper/AFMotor_MultiStepper.pde @@ -0,0 +1,56 @@ +// MultiStepper +// -*- mode: C++ -*- +// +// Control both Stepper motors at the same time with different speeds +// and accelerations. +// Requires the AFMotor library (https://github.com/adafruit/Adafruit-Motor-Shield-library) +// And AccelStepper with AFMotor support (https://github.com/adafruit/AccelStepper) +// Public domain! + +#include +#include + +// two stepper motors one on each port +AF_Stepper motor1(200, 1); +AF_Stepper motor2(200, 2); + +// you can change these to DOUBLE or INTERLEAVE or MICROSTEP! +// wrappers for the first motor! +void forwardstep1() { + motor1.onestep(FORWARD, SINGLE); +} +void backwardstep1() { + motor1.onestep(BACKWARD, SINGLE); +} +// wrappers for the second motor! +void forwardstep2() { + motor2.onestep(FORWARD, SINGLE); +} +void backwardstep2() { + motor2.onestep(BACKWARD, SINGLE); +} + +// Motor shield has two motor ports, now we'll wrap them in an AccelStepper object +AccelStepper stepper1(forwardstep1, backwardstep1); +AccelStepper stepper2(forwardstep2, backwardstep2); + +void setup() +{ + stepper1.setMaxSpeed(200.0); + stepper1.setAcceleration(100.0); + stepper1.moveTo(24); + + stepper2.setMaxSpeed(300.0); + stepper2.setAcceleration(100.0); + stepper2.moveTo(1000000); + +} + +void loop() +{ + // Change direction at the limits + if (stepper1.distanceToGo() == 0) + stepper1.moveTo(-stepper1.currentPosition()); + stepper1.run(); + stepper2.run(); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Blocking/Blocking.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Blocking/Blocking.pde new file mode 100644 index 0000000..33534a6 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Blocking/Blocking.pde @@ -0,0 +1,28 @@ +// Blocking.pde +// -*- mode: C++ -*- +// +// Shows how to use the blocking call runToNewPosition +// Which sets a new target position and then waits until the stepper has +// achieved it. +// +// Copyright (C) 2009 Mike McCauley +// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $ + +#include + +// Define a stepper and the pins it will use +AccelStepper stepper; // Defaults to 4 pins on 2, 3, 4, 5 + +void setup() +{ + stepper.setMaxSpeed(200.0); + stepper.setAcceleration(100.0); +} + +void loop() +{ + stepper.runToNewPosition(0); + stepper.runToNewPosition(500); + stepper.runToNewPosition(100); + stepper.runToNewPosition(120); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/ConstantSpeed/ConstantSpeed.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/ConstantSpeed/ConstantSpeed.pde new file mode 100644 index 0000000..52a8044 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/ConstantSpeed/ConstantSpeed.pde @@ -0,0 +1,22 @@ +// ConstantSpeed.pde +// -*- mode: C++ -*- +// +// Shows how to run AccelStepper in the simplest, +// fixed speed mode with no accelerations +/// \author Mike McCauley (mikem@open.com.au) +// Copyright (C) 2009 Mike McCauley +// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $ + +#include + +AccelStepper stepper; // Defaults to 4 pins on 2, 3, 4, 5 + +void setup() +{ + stepper.setSpeed(50); +} + +void loop() +{ + stepper.runSpeed(); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/MultiStepper/MultiStepper.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/MultiStepper/MultiStepper.pde new file mode 100644 index 0000000..e5d6fb9 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/MultiStepper/MultiStepper.pde @@ -0,0 +1,41 @@ +// MultiStepper.pde +// -*- mode: C++ -*- +// +// Shows how to multiple simultaneous steppers +// Runs one stepper forwards and backwards, accelerating and decelerating +// at the limits. Runs other steppers at the same time +// +// Copyright (C) 2009 Mike McCauley +// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $ + +#include + +// Define some steppers and the pins the will use +AccelStepper stepper1; // Defaults to 4 pins on 2, 3, 4, 5 +AccelStepper stepper2(4, 6, 7, 8, 9); +AccelStepper stepper3(2, 10, 11); + +void setup() +{ + stepper1.setMaxSpeed(200.0); + stepper1.setAcceleration(100.0); + stepper1.moveTo(24); + + stepper2.setMaxSpeed(300.0); + stepper2.setAcceleration(100.0); + stepper2.moveTo(1000000); + + stepper3.setMaxSpeed(300.0); + stepper3.setAcceleration(100.0); + stepper3.moveTo(1000000); +} + +void loop() +{ + // Change direction at the limits + if (stepper1.distanceToGo() == 0) + stepper1.moveTo(-stepper1.currentPosition()); + stepper1.run(); + stepper2.run(); + stepper3.run(); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Overshoot/Overshoot.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Overshoot/Overshoot.pde new file mode 100644 index 0000000..e7eb42c --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Overshoot/Overshoot.pde @@ -0,0 +1,31 @@ +// Overshoot.pde +// -*- mode: C++ -*- +// +// Check overshoot handling +// which sets a new target position and then waits until the stepper has +// achieved it. This is used for testing the handling of overshoots +// +// Copyright (C) 2009 Mike McCauley +// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $ + +#include + +// Define a stepper and the pins it will use +AccelStepper stepper; // Defaults to 4 pins on 2, 3, 4, 5 + +void setup() +{ +} + +void loop() +{ + stepper.setMaxSpeed(200); + stepper.setAcceleration(50); + stepper.runToNewPosition(0); + + stepper.moveTo(500); + while (stepper.currentPosition() != 300) + stepper.run(); + // cause an overshoot as we whiz past 300 + stepper.setCurrentPosition(600); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Random/Random.pde b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Random/Random.pde new file mode 100644 index 0000000..a30cb33 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/examples/Random/Random.pde @@ -0,0 +1,30 @@ +// Random.pde +// -*- mode: C++ -*- +// +// Make a single stepper perform random changes in speed, position and acceleration +// +// Copyright (C) 2009 Mike McCauley +// $Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem $ + +#include + +// Define a stepper and the pins it will use +AccelStepper stepper; // Defaults to 4 pins on 2, 3, 4, 5 + +void setup() +{ +} + +void loop() +{ + if (stepper.distanceToGo() == 0) + { + // Random change to speed, position and acceleration + // Make sure we dont get 0 speed or accelerations + delay(1000); + stepper.moveTo(rand() % 200); + stepper.setMaxSpeed((rand() % 200) + 1); + stepper.setAcceleration((rand() % 200) + 1); + } + stepper.run(); +} diff --git a/shields/Adafruit Motor Shield v2.3/AccelStepper Library/project.cfg b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/project.cfg new file mode 100644 index 0000000..c38326c --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/AccelStepper Library/project.cfg @@ -0,0 +1,1294 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = AccelStepper + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = doc + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.cpp b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.cpp new file mode 100644 index 0000000..4fd0150 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.cpp @@ -0,0 +1,398 @@ +/****************************************************************** + This is the library for the Adafruit Motor Shield V2 for Arduino. + It supports DC motors & Stepper motors with microstepping as well + as stacking-support. It is *not* compatible with the V1 library! + + It will only work with https://www.adafruit.com/products/1483 + + Adafruit invests time and resources providing this open + source code, please support Adafruit and open-source hardware + by purchasing products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, check license.txt for more information. + All text above must be included in any redistribution. + ******************************************************************/ + + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif +#include +#include "Adafruit_MotorShield.h" +#include + +#if defined(ARDUINO_SAM_DUE) + #define WIRE Wire1 +#else + #define WIRE Wire +#endif + + +#if (MICROSTEPS == 8) +uint8_t microstepcurve[] = {0, 50, 98, 142, 180, 212, 236, 250, 255}; +#elif (MICROSTEPS == 16) +uint8_t microstepcurve[] = {0, 25, 50, 74, 98, 120, 141, 162, 180, 197, 212, 225, 236, 244, 250, 253, 255}; +#endif + +Adafruit_MotorShield::Adafruit_MotorShield(uint8_t addr) { + _addr = addr; + _pwm = Adafruit_MS_PWMServoDriver(_addr); +} + +void Adafruit_MotorShield::begin(uint16_t freq) { + // init PWM w/_freq + WIRE.begin(); + _pwm.begin(); + _freq = freq; + _pwm.setPWMFreq(_freq); // This is the maximum PWM frequency + for (uint8_t i=0; i<16; i++) + _pwm.setPWM(i, 0, 0); +} + +void Adafruit_MotorShield::setPWM(uint8_t pin, uint16_t value) { + if (value > 4095) { + _pwm.setPWM(pin, 4096, 0); + } else + _pwm.setPWM(pin, 0, value); +} +void Adafruit_MotorShield::setPin(uint8_t pin, boolean value) { + if (value == LOW) + _pwm.setPWM(pin, 0, 0); + else + _pwm.setPWM(pin, 4096, 0); +} + +Adafruit_DCMotor *Adafruit_MotorShield::getMotor(uint8_t num) { + if (num > 4) return NULL; + + num--; + + if (dcmotors[num].motornum == 0) { + // not init'd yet! + dcmotors[num].motornum = num; + dcmotors[num].MC = this; + uint8_t pwm, in1, in2; + if (num == 0) { + pwm = 8; in2 = 9; in1 = 10; + } else if (num == 1) { + pwm = 13; in2 = 12; in1 = 11; + } else if (num == 2) { + pwm = 2; in2 = 3; in1 = 4; + } else if (num == 3) { + pwm = 7; in2 = 6; in1 = 5; + } + dcmotors[num].PWMpin = pwm; + dcmotors[num].IN1pin = in1; + dcmotors[num].IN2pin = in2; + } + return &dcmotors[num]; +} + + +Adafruit_StepperMotor *Adafruit_MotorShield::getStepper(uint16_t steps, uint8_t num) { + if (num > 2) return NULL; + + num--; + + if (steppers[num].steppernum == 0) { + // not init'd yet! + steppers[num].steppernum = num; + steppers[num].revsteps = steps; + steppers[num].MC = this; + uint8_t pwma, pwmb, ain1, ain2, bin1, bin2; + if (num == 0) { + pwma = 8; ain2 = 9; ain1 = 10; + pwmb = 13; bin2 = 12; bin1 = 11; + } else if (num == 1) { + pwma = 2; ain2 = 3; ain1 = 4; + pwmb = 7; bin2 = 6; bin1 = 5; + } + steppers[num].PWMApin = pwma; + steppers[num].PWMBpin = pwmb; + steppers[num].AIN1pin = ain1; + steppers[num].AIN2pin = ain2; + steppers[num].BIN1pin = bin1; + steppers[num].BIN2pin = bin2; + } + return &steppers[num]; +} + + +/****************************************** + MOTORS +******************************************/ + +Adafruit_DCMotor::Adafruit_DCMotor(void) { + MC = NULL; + motornum = 0; + PWMpin = IN1pin = IN2pin = 0; +} + +void Adafruit_DCMotor::run(uint8_t cmd) { + switch (cmd) { + case FORWARD: + MC->setPin(IN2pin, LOW); // take low first to avoid 'break' + MC->setPin(IN1pin, HIGH); + break; + case BACKWARD: + MC->setPin(IN1pin, LOW); // take low first to avoid 'break' + MC->setPin(IN2pin, HIGH); + break; + case RELEASE: + MC->setPin(IN1pin, LOW); + MC->setPin(IN2pin, LOW); + break; + } +} + +void Adafruit_DCMotor::setSpeed(uint8_t speed) { + MC->setPWM(PWMpin, speed*16); +} + +/****************************************** + STEPPERS +******************************************/ + +Adafruit_StepperMotor::Adafruit_StepperMotor(void) { + revsteps = steppernum = currentstep = 0; +} +/* + +uint16_t steps, Adafruit_MotorShield controller) { + + revsteps = steps; + steppernum = 1; + currentstep = 0; + + if (steppernum == 1) { + latch_state &= ~_BV(MOTOR1_A) & ~_BV(MOTOR1_B) & + ~_BV(MOTOR2_A) & ~_BV(MOTOR2_B); // all motor pins to 0 + + // enable both H bridges + pinMode(11, OUTPUT); + pinMode(3, OUTPUT); + digitalWrite(11, HIGH); + digitalWrite(3, HIGH); + + // use PWM for microstepping support + MC->setPWM(1, 255); + MC->setPWM(2, 255); + + } else if (steppernum == 2) { + latch_state &= ~_BV(MOTOR3_A) & ~_BV(MOTOR3_B) & + ~_BV(MOTOR4_A) & ~_BV(MOTOR4_B); // all motor pins to 0 + + // enable both H bridges + pinMode(5, OUTPUT); + pinMode(6, OUTPUT); + digitalWrite(5, HIGH); + digitalWrite(6, HIGH); + + // use PWM for microstepping support + // use PWM for microstepping support + MC->setPWM(3, 255); + MC->setPWM(4, 255); + } +} +*/ + +void Adafruit_StepperMotor::setSpeed(uint16_t rpm) { + //Serial.println("steps per rev: "); Serial.println(revsteps); + //Serial.println("RPM: "); Serial.println(rpm); + + usperstep = 60000000 / ((uint32_t)revsteps * (uint32_t)rpm); +} + +void Adafruit_StepperMotor::release(void) { + MC->setPin(AIN1pin, LOW); + MC->setPin(AIN2pin, LOW); + MC->setPin(BIN1pin, LOW); + MC->setPin(BIN2pin, LOW); + MC->setPWM(PWMApin, 0); + MC->setPWM(PWMBpin, 0); +} + +void Adafruit_StepperMotor::step(uint16_t steps, uint8_t dir, uint8_t style) { + uint32_t uspers = usperstep; + uint8_t ret = 0; + + if (style == INTERLEAVE) { + uspers /= 2; + } + else if (style == MICROSTEP) { + uspers /= MICROSTEPS; + steps *= MICROSTEPS; +#ifdef MOTORDEBUG + Serial.print("steps = "); Serial.println(steps, DEC); +#endif + } + + while (steps--) { + //Serial.println("step!"); Serial.println(uspers); + ret = onestep(dir, style); + delayMicroseconds(uspers); + yield(); // required for ESP8266 + } +} + +uint8_t Adafruit_StepperMotor::onestep(uint8_t dir, uint8_t style) { + uint8_t a, b, c, d; + uint8_t ocrb, ocra; + + ocra = ocrb = 255; + + + // next determine what sort of stepping procedure we're up to + if (style == SINGLE) { + if ((currentstep/(MICROSTEPS/2)) % 2) { // we're at an odd step, weird + if (dir == FORWARD) { + currentstep += MICROSTEPS/2; + } + else { + currentstep -= MICROSTEPS/2; + } + } else { // go to the next even step + if (dir == FORWARD) { + currentstep += MICROSTEPS; + } + else { + currentstep -= MICROSTEPS; + } + } + } else if (style == DOUBLE) { + if (! (currentstep/(MICROSTEPS/2) % 2)) { // we're at an even step, weird + if (dir == FORWARD) { + currentstep += MICROSTEPS/2; + } else { + currentstep -= MICROSTEPS/2; + } + } else { // go to the next odd step + if (dir == FORWARD) { + currentstep += MICROSTEPS; + } else { + currentstep -= MICROSTEPS; + } + } + } else if (style == INTERLEAVE) { + if (dir == FORWARD) { + currentstep += MICROSTEPS/2; + } else { + currentstep -= MICROSTEPS/2; + } + } + + if (style == MICROSTEP) { + if (dir == FORWARD) { + currentstep++; + } else { + // BACKWARDS + currentstep--; + } + + currentstep += MICROSTEPS*4; + currentstep %= MICROSTEPS*4; + + ocra = ocrb = 0; + if ( (currentstep >= 0) && (currentstep < MICROSTEPS)) { + ocra = microstepcurve[MICROSTEPS - currentstep]; + ocrb = microstepcurve[currentstep]; + } else if ( (currentstep >= MICROSTEPS) && (currentstep < MICROSTEPS*2)) { + ocra = microstepcurve[currentstep - MICROSTEPS]; + ocrb = microstepcurve[MICROSTEPS*2 - currentstep]; + } else if ( (currentstep >= MICROSTEPS*2) && (currentstep < MICROSTEPS*3)) { + ocra = microstepcurve[MICROSTEPS*3 - currentstep]; + ocrb = microstepcurve[currentstep - MICROSTEPS*2]; + } else if ( (currentstep >= MICROSTEPS*3) && (currentstep < MICROSTEPS*4)) { + ocra = microstepcurve[currentstep - MICROSTEPS*3]; + ocrb = microstepcurve[MICROSTEPS*4 - currentstep]; + } + } + + currentstep += MICROSTEPS*4; + currentstep %= MICROSTEPS*4; + +#ifdef MOTORDEBUG + Serial.print("current step: "); Serial.println(currentstep, DEC); + Serial.print(" pwmA = "); Serial.print(ocra, DEC); + Serial.print(" pwmB = "); Serial.println(ocrb, DEC); +#endif + MC->setPWM(PWMApin, ocra*16); + MC->setPWM(PWMBpin, ocrb*16); + + + // release all + uint8_t latch_state = 0; // all motor pins to 0 + + //Serial.println(step, DEC); + if (style == MICROSTEP) { + if ((currentstep >= 0) && (currentstep < MICROSTEPS)) + latch_state |= 0x03; + if ((currentstep >= MICROSTEPS) && (currentstep < MICROSTEPS*2)) + latch_state |= 0x06; + if ((currentstep >= MICROSTEPS*2) && (currentstep < MICROSTEPS*3)) + latch_state |= 0x0C; + if ((currentstep >= MICROSTEPS*3) && (currentstep < MICROSTEPS*4)) + latch_state |= 0x09; + } else { + switch (currentstep/(MICROSTEPS/2)) { + case 0: + latch_state |= 0x1; // energize coil 1 only + break; + case 1: + latch_state |= 0x3; // energize coil 1+2 + break; + case 2: + latch_state |= 0x2; // energize coil 2 only + break; + case 3: + latch_state |= 0x6; // energize coil 2+3 + break; + case 4: + latch_state |= 0x4; // energize coil 3 only + break; + case 5: + latch_state |= 0xC; // energize coil 3+4 + break; + case 6: + latch_state |= 0x8; // energize coil 4 only + break; + case 7: + latch_state |= 0x9; // energize coil 1+4 + break; + } + } +#ifdef MOTORDEBUG + Serial.print("Latch: 0x"); Serial.println(latch_state, HEX); +#endif + + if (latch_state & 0x1) { + // Serial.println(AIN2pin); + MC->setPin(AIN2pin, HIGH); + } else { + MC->setPin(AIN2pin, LOW); + } + if (latch_state & 0x2) { + MC->setPin(BIN1pin, HIGH); + // Serial.println(BIN1pin); + } else { + MC->setPin(BIN1pin, LOW); + } + if (latch_state & 0x4) { + MC->setPin(AIN1pin, HIGH); + // Serial.println(AIN1pin); + } else { + MC->setPin(AIN1pin, LOW); + } + if (latch_state & 0x8) { + MC->setPin(BIN2pin, HIGH); + // Serial.println(BIN2pin); + } else { + MC->setPin(BIN2pin, LOW); + } + + return currentstep; +} + diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.h b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.h new file mode 100644 index 0000000..48d0332 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/Adafruit_MotorShield.h @@ -0,0 +1,102 @@ +/****************************************************************** + This is the library for the Adafruit Motor Shield V2 for Arduino. + It supports DC motors & Stepper motors with microstepping as well + as stacking-support. It is *not* compatible with the V1 library! + + It will only work with https://www.adafruit.com/products/1483 + + Adafruit invests time and resources providing this open + source code, please support Adafruit and open-source hardware + by purchasing products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, check license.txt for more information. + All text above must be included in any redistribution. + ******************************************************************/ + +#ifndef _Adafruit_MotorShield_h_ +#define _Adafruit_MotorShield_h_ + +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +//#define MOTORDEBUG + +#define MICROSTEPS 16 // 8 or 16 + +#define MOTOR1_A 2 +#define MOTOR1_B 3 +#define MOTOR2_A 1 +#define MOTOR2_B 4 +#define MOTOR4_A 0 +#define MOTOR4_B 6 +#define MOTOR3_A 5 +#define MOTOR3_B 7 + +#define FORWARD 1 +#define BACKWARD 2 +#define BRAKE 3 +#define RELEASE 4 + +#define SINGLE 1 +#define DOUBLE 2 +#define INTERLEAVE 3 +#define MICROSTEP 4 + +class Adafruit_MotorShield; + +class Adafruit_DCMotor +{ + public: + Adafruit_DCMotor(void); + friend class Adafruit_MotorShield; + void run(uint8_t); + void setSpeed(uint8_t); + + private: + uint8_t PWMpin, IN1pin, IN2pin; + Adafruit_MotorShield *MC; + uint8_t motornum; +}; + +class Adafruit_StepperMotor { + public: + Adafruit_StepperMotor(void); + friend class Adafruit_MotorShield; + + void step(uint16_t steps, uint8_t dir, uint8_t style = SINGLE); + void setSpeed(uint16_t); + uint8_t onestep(uint8_t dir, uint8_t style); + void release(void); + uint32_t usperstep; + + private: + uint8_t PWMApin, AIN1pin, AIN2pin; + uint8_t PWMBpin, BIN1pin, BIN2pin; + uint16_t revsteps; // # steps per revolution + uint8_t currentstep; + Adafruit_MotorShield *MC; + uint8_t steppernum; +}; + +class Adafruit_MotorShield +{ + public: + Adafruit_MotorShield(uint8_t addr = 0x60); + friend class Adafruit_DCMotor; + void begin(uint16_t freq = 1600); + + void setPWM(uint8_t pin, uint16_t val); + void setPin(uint8_t pin, boolean val); + Adafruit_DCMotor *getMotor(uint8_t n); + Adafruit_StepperMotor *getStepper(uint16_t steps, uint8_t n); + private: + uint8_t _addr; + uint16_t _freq; + Adafruit_DCMotor dcmotors[4]; + Adafruit_StepperMotor steppers[2]; + Adafruit_MS_PWMServoDriver _pwm; +}; + +#endif diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/README.md b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/README.md new file mode 100644 index 0000000..20b99aa --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/README.md @@ -0,0 +1,47 @@ +# Adafruit Motor Shield v2 Library + +This is the library for the Adafruit Motor Shield V2 for Arduino. +It supports DC motors & Stepper motors with microstepping as well +as stacking-support. It is *not* compatible with the V1 library! + +It will only work with https://www.adafruit.com/products/1438 + + + +## Compatibility + +MCU | Tested Works | Doesn't Work | Not Tested | Notes +------------------ | :----------: | :----------: | :---------: | ----- +Atmega328 @ 16MHz | X | | | +Atmega328 @ 12MHz | X | | | +Atmega32u4 @ 16MHz | X | | | +Atmega32u4 @ 8MHz | X | | | +ESP8266 | | | X | +Atmega2560 @ 16MHz | X | | | +ATSAM3X8E | | X | | +ATSAM21D | | X | | +ATtiny85 @ 16MHz | | | X | +ATtiny85 @ 8MHz | | | X | +Intel Curie @ 32MHz | | | X | +STM32F2 | | | X | + + * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini + * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V + * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 + * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro + * ESP8266 : Adafruit Huzzah + * ATmega2560 @ 16MHz : Arduino Mega + * ATSAM3X8E : Arduino Due + * ATSAM21D : Arduino Zero, M0 Pro + * ATtiny85 @ 16MHz : Adafruit Trinket 5V + * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V + + + + Adafruit invests time and resources providing this open + source code, please support Adafruit and open-source hardware + by purchasing products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, check license.txt for more information. + All text above must be included in any redistribution. diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_ConstantSpeed/Accel_ConstantSpeed.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_ConstantSpeed/Accel_ConstantSpeed.ino new file mode 100644 index 0000000..7b2aa94 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_ConstantSpeed/Accel_ConstantSpeed.ino @@ -0,0 +1,52 @@ +// ConstantSpeed.pde +// -*- mode: C++ -*- +// +// Shows how to run AccelStepper in the simplest, +// fixed speed mode with no accelerations +// Requires the Adafruit_Motorshield v2 library +// https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library +// And AccelStepper with AFMotor support +// https://github.com/adafruit/AccelStepper + +// This tutorial is for Adafruit Motorshield v2 only! +// Will not work with v1 shields + +#include +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +// Create the motor shield object with the default I2C address +Adafruit_MotorShield AFMS = Adafruit_MotorShield(); +// Or, create it with a different I2C address (say for stacking) +// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); + +// Connect a stepper motor with 200 steps per revolution (1.8 degree) +// to motor port #2 (M3 and M4) +Adafruit_StepperMotor *myStepper1 = AFMS.getStepper(200, 2); + +// you can change these to DOUBLE or INTERLEAVE or MICROSTEP! +void forwardstep1() { + myStepper1->onestep(FORWARD, SINGLE); +} +void backwardstep1() { + myStepper1->onestep(BACKWARD, SINGLE); +} + +AccelStepper Astepper1(forwardstep1, backwardstep1); // use functions to step + +void setup() +{ + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("Stepper test!"); + + AFMS.begin(); // create with the default frequency 1.6KHz + //AFMS.begin(1000); // OR with a different frequency, say 1KHz + + Astepper1.setSpeed(50); +} + +void loop() +{ + Astepper1.runSpeed(); +} diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_MultiStepper/Accel_MultiStepper.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_MultiStepper/Accel_MultiStepper.ino new file mode 100644 index 0000000..62052bf --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/Accel_MultiStepper/Accel_MultiStepper.ino @@ -0,0 +1,90 @@ +// Shows how to run three Steppers at once with varying speeds +// +// Requires the Adafruit_Motorshield v2 library +// https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library +// And AccelStepper with AFMotor support +// https://github.com/adafruit/AccelStepper + +// This tutorial is for Adafruit Motorshield v2 only! +// Will not work with v1 shields + +#include +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +Adafruit_MotorShield AFMSbot(0x61); // Rightmost jumper closed +Adafruit_MotorShield AFMStop(0x60); // Default address, no jumpers + +// Connect two steppers with 200 steps per revolution (1.8 degree) +// to the top shield +Adafruit_StepperMotor *myStepper1 = AFMStop.getStepper(200, 1); +Adafruit_StepperMotor *myStepper2 = AFMStop.getStepper(200, 2); + +// Connect one stepper with 200 steps per revolution (1.8 degree) +// to the bottom shield +Adafruit_StepperMotor *myStepper3 = AFMSbot.getStepper(200, 2); + +// you can change these to DOUBLE or INTERLEAVE or MICROSTEP! +// wrappers for the first motor! +void forwardstep1() { + myStepper1->onestep(FORWARD, SINGLE); +} +void backwardstep1() { + myStepper1->onestep(BACKWARD, SINGLE); +} +// wrappers for the second motor! +void forwardstep2() { + myStepper2->onestep(FORWARD, DOUBLE); +} +void backwardstep2() { + myStepper2->onestep(BACKWARD, DOUBLE); +} +// wrappers for the third motor! +void forwardstep3() { + myStepper3->onestep(FORWARD, INTERLEAVE); +} +void backwardstep3() { + myStepper3->onestep(BACKWARD, INTERLEAVE); +} + +// Now we'll wrap the 3 steppers in an AccelStepper object +AccelStepper stepper1(forwardstep1, backwardstep1); +AccelStepper stepper2(forwardstep2, backwardstep2); +AccelStepper stepper3(forwardstep3, backwardstep3); + +void setup() +{ + AFMSbot.begin(); // Start the bottom shield + AFMStop.begin(); // Start the top shield + + stepper1.setMaxSpeed(100.0); + stepper1.setAcceleration(100.0); + stepper1.moveTo(24); + + stepper2.setMaxSpeed(200.0); + stepper2.setAcceleration(100.0); + stepper2.moveTo(50000); + + stepper3.setMaxSpeed(300.0); + stepper3.setAcceleration(100.0); + stepper3.moveTo(1000000); +} + +void loop() +{ + // Change direction at the limits + if (stepper1.distanceToGo() == 0) + stepper1.moveTo(-stepper1.currentPosition()); + + if (stepper2.distanceToGo() == 0) + stepper2.moveTo(-stepper2.currentPosition()); + + if (stepper3.distanceToGo() == 0) + stepper3.moveTo(-stepper3.currentPosition()); + + stepper1.run(); + stepper2.run(); + stepper3.run(); +} + diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/DCMotorTest/DCMotorTest.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/DCMotorTest/DCMotorTest.ino new file mode 100644 index 0000000..e1f0557 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/DCMotorTest/DCMotorTest.ino @@ -0,0 +1,68 @@ +/* +This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2 +It won't work with v1.x motor shields! Only for the v2's with built in PWM +control + +For use with the Adafruit Motor Shield v2 +----> http://www.adafruit.com/products/1438 +*/ + +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +// Create the motor shield object with the default I2C address +Adafruit_MotorShield AFMS = Adafruit_MotorShield(); +// Or, create it with a different I2C address (say for stacking) +// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); + +// Select which 'port' M1, M2, M3 or M4. In this case, M1 +Adafruit_DCMotor *myMotor = AFMS.getMotor(1); +// You can also make another motor on port M2 +//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2); + +void setup() { + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("Adafruit Motorshield v2 - DC Motor test!"); + + AFMS.begin(); // create with the default frequency 1.6KHz + //AFMS.begin(1000); // OR with a different frequency, say 1KHz + + // Set the speed to start, from 0 (off) to 255 (max speed) + myMotor->setSpeed(150); + myMotor->run(FORWARD); + // turn on motor + myMotor->run(RELEASE); +} + +void loop() { + uint8_t i; + + Serial.print("tick"); + + myMotor->run(FORWARD); + for (i=0; i<255; i++) { + myMotor->setSpeed(i); + delay(10); + } + for (i=255; i!=0; i--) { + myMotor->setSpeed(i); + delay(10); + } + + Serial.print("tock"); + + myMotor->run(BACKWARD); + for (i=0; i<255; i++) { + myMotor->setSpeed(i); + delay(10); + } + for (i=255; i!=0; i--) { + myMotor->setSpeed(i); + delay(10); + } + + Serial.print("tech"); + myMotor->run(RELEASE); + delay(1000); +} \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/MotorParty/MotorParty.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/MotorParty/MotorParty.ino new file mode 100644 index 0000000..6583cd7 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/MotorParty/MotorParty.ino @@ -0,0 +1,84 @@ +/* +This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2 +It won't work with v1.x motor shields! Only for the v2's with built in PWM +control + +For use with the Adafruit Motor Shield v2 +----> http://www.adafruit.com/products/1438 + +This sketch creates a fun motor party on your desk *whiirrr* +Connect a unipolar/bipolar stepper to M3/M4 +Connect a DC motor to M1 +Connect a hobby servo to SERVO1 +*/ + +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" +#include + +// Create the motor shield object with the default I2C address +Adafruit_MotorShield AFMS = Adafruit_MotorShield(); +// Or, create it with a different I2C address (say for stacking) +// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); + +// Connect a stepper motor with 200 steps per revolution (1.8 degree) +// to motor port #2 (M3 and M4) +Adafruit_StepperMotor *myStepper = AFMS.getStepper(200, 2); +// And connect a DC motor to port M1 +Adafruit_DCMotor *myMotor = AFMS.getMotor(1); + +// We'll also test out the built in Arduino Servo library +Servo servo1; + + +void setup() { + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("MMMMotor party!"); + + AFMS.begin(); // create with the default frequency 1.6KHz + //AFMS.begin(1000); // OR with a different frequency, say 1KHz + + // Attach a servo to pin #10 + servo1.attach(10); + + // turn on motor M1 + myMotor->setSpeed(200); + myMotor->run(RELEASE); + + // setup the stepper + myStepper->setSpeed(10); // 10 rpm +} + +int i; +void loop() { + myMotor->run(FORWARD); + for (i=0; i<255; i++) { + servo1.write(map(i, 0, 255, 0, 180)); + myMotor->setSpeed(i); + myStepper->step(1, FORWARD, INTERLEAVE); + delay(3); + } + + for (i=255; i!=0; i--) { + servo1.write(map(i, 0, 255, 0, 180)); + myMotor->setSpeed(i); + myStepper->step(1, BACKWARD, INTERLEAVE); + delay(3); + } + + myMotor->run(BACKWARD); + for (i=0; i<255; i++) { + servo1.write(map(i, 0, 255, 0, 180)); + myMotor->setSpeed(i); + myStepper->step(1, FORWARD, DOUBLE); + delay(3); + } + + for (i=255; i!=0; i--) { + servo1.write(map(i, 0, 255, 0, 180)); + myMotor->setSpeed(i); + myStepper->step(1, BACKWARD, DOUBLE); + delay(3); + } +} \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StackingTest/StackingTest.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StackingTest/StackingTest.ino new file mode 100644 index 0000000..ace5af4 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StackingTest/StackingTest.ino @@ -0,0 +1,76 @@ +/* +This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2 +It won't work with v1.x motor shields! Only for the v2's with built in PWM +control + +For use with the Adafruit Motor Shield v2 +----> http://www.adafruit.com/products/1438 +*/ + +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +Adafruit_MotorShield AFMSbot(0x61); // Rightmost jumper closed +Adafruit_MotorShield AFMStop(0x60); // Default address, no jumpers + +// On the top shield, connect two steppers, each with 200 steps +Adafruit_StepperMotor *myStepper2 = AFMStop.getStepper(200, 1); +Adafruit_StepperMotor *myStepper3 = AFMStop.getStepper(200, 2); + +// On the bottom shield connect a stepper to port M3/M4 with 200 steps +Adafruit_StepperMotor *myStepper1 = AFMSbot.getStepper(200, 2); +// And a DC Motor to port M1 +Adafruit_DCMotor *myMotor1 = AFMSbot.getMotor(1); + +void setup() { + while (!Serial); + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("MMMMotor party!"); + + AFMSbot.begin(); // Start the bottom shield + AFMStop.begin(); // Start the top shield + + // turn on the DC motor + myMotor1->setSpeed(200); + myMotor1->run(RELEASE); +} + +int i; +void loop() { + myMotor1->run(FORWARD); + + for (i=0; i<255; i++) { + myMotor1->setSpeed(i); + myStepper1->onestep(FORWARD, INTERLEAVE); + myStepper2->onestep(BACKWARD, DOUBLE); + myStepper3->onestep(FORWARD, MICROSTEP); + delay(3); + } + + for (i=255; i!=0; i--) { + myMotor1->setSpeed(i); + myStepper1->onestep(BACKWARD, INTERLEAVE); + myStepper2->onestep(FORWARD, DOUBLE); + myStepper3->onestep(BACKWARD, MICROSTEP); + delay(3); + } + + myMotor1->run(BACKWARD); + + for (i=0; i<255; i++) { + myMotor1->setSpeed(i); + myStepper1->onestep(FORWARD, DOUBLE); + myStepper2->onestep(BACKWARD, INTERLEAVE); + myStepper3->onestep(FORWARD, MICROSTEP); + delay(3); + } + + for (i=255; i!=0; i--) { + myMotor1->setSpeed(i); + myStepper1->onestep(BACKWARD, DOUBLE); + myStepper2->onestep(FORWARD, INTERLEAVE); + myStepper3->onestep(BACKWARD, MICROSTEP); + delay(3); + } +} \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StepperTest/StepperTest.ino b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StepperTest/StepperTest.ino new file mode 100644 index 0000000..da76ba8 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/examples/StepperTest/StepperTest.ino @@ -0,0 +1,51 @@ +/* +This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2 +It won't work with v1.x motor shields! Only for the v2's with built in PWM +control + +For use with the Adafruit Motor Shield v2 +----> http://www.adafruit.com/products/1438 +*/ + + +#include +#include +#include "utility/Adafruit_MS_PWMServoDriver.h" + +// Create the motor shield object with the default I2C address +Adafruit_MotorShield AFMS = Adafruit_MotorShield(); +// Or, create it with a different I2C address (say for stacking) +// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); + +// Connect a stepper motor with 200 steps per revolution (1.8 degree) +// to motor port #2 (M3 and M4) +Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2); + + +void setup() { + Serial.begin(9600); // set up Serial library at 9600 bps + Serial.println("Stepper test!"); + + AFMS.begin(); // create with the default frequency 1.6KHz + //AFMS.begin(1000); // OR with a different frequency, say 1KHz + + myMotor->setSpeed(10); // 10 rpm +} + +void loop() { + Serial.println("Single coil steps"); + myMotor->step(100, FORWARD, SINGLE); + myMotor->step(100, BACKWARD, SINGLE); + + Serial.println("Double coil steps"); + myMotor->step(100, FORWARD, DOUBLE); + myMotor->step(100, BACKWARD, DOUBLE); + + Serial.println("Interleave coil steps"); + myMotor->step(100, FORWARD, INTERLEAVE); + myMotor->step(100, BACKWARD, INTERLEAVE); + + Serial.println("Microstep steps"); + myMotor->step(50, FORWARD, MICROSTEP); + myMotor->step(50, BACKWARD, MICROSTEP); +} \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/keywords.txt b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/keywords.txt new file mode 100644 index 0000000..ae1d741 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/keywords.txt @@ -0,0 +1,40 @@ +####################################### +# Syntax Coloring Map for AFMotor +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +Adafruit_MotorShield KEYWORD1 +Adafruit_DCMotor KEYWORD1 +Adafruit_StepperMotor KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +enable KEYWORD2 +run KEYWORD2 +setSpeed KEYWORD2 +step KEYWORD2 +onestep KEYWORD2 +release KEYWORD2 +getMotor KEYWORD2 +getStepper KEYWORD2 +setPin KEYWORD2 +setPWM KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### + +MICROSTEPPING LITERAL1 +FORWARD LITERAL1 +BACKWARD LITERAL1 +BRAKE LITERAL1 +RELEASE LITERAL1 +SINGLE LITERAL1 +DOUBLE LITERAL1 +INTERLEAVE LITERAL1 +MICROSTEP LITERAL1 \ No newline at end of file diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/library.properties b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/library.properties new file mode 100644 index 0000000..ca5970f --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/library.properties @@ -0,0 +1,9 @@ +name=Adafruit Motor Shield V2 Library +version=1.0.4 +author=Adafruit +maintainer=Adafruit +sentence=Library for the Adafruit Motor Shield V2 for Arduino. It supports DC motors & stepper motors with microstepping as well as stacking-support. +paragraph=Library for the Adafruit Motor Shield V2 for Arduino. It supports DC motors & stepper motors with microstepping as well as stacking-support. +category=Device Control +url=https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library +architectures=* diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/license.txt b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/license.txt new file mode 100644 index 0000000..4bbfa39 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/license.txt @@ -0,0 +1,25 @@ +Software License Agreement (BSD License) + +Copyright (c) 2012, Adafruit Industries. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holders nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.cpp b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.cpp new file mode 100644 index 0000000..1763209 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.cpp @@ -0,0 +1,113 @@ +/*************************************************** + This is a library for our Adafruit 16-channel PWM & Servo driver + + Pick one up today in the adafruit shop! + ------> http://www.adafruit.com/products/815 + + These displays use I2C to communicate, 2 pins are required to + interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 + + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ****************************************************/ + +#include +#include +#if defined(ARDUINO_SAM_DUE) + #define WIRE Wire1 +#else + #define WIRE Wire +#endif + + +Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(uint8_t addr) { + _i2caddr = addr; +} + +void Adafruit_MS_PWMServoDriver::begin(void) { + WIRE.begin(); + reset(); +} + + +void Adafruit_MS_PWMServoDriver::reset(void) { + write8(PCA9685_MODE1, 0x0); +} + +void Adafruit_MS_PWMServoDriver::setPWMFreq(float freq) { + //Serial.print("Attempting to set freq "); + //Serial.println(freq); + + freq *= 0.9; // Correct for overshoot in the frequency setting (see issue #11). + + float prescaleval = 25000000; + prescaleval /= 4096; + prescaleval /= freq; + prescaleval -= 1; + //Serial.print("Estimated pre-scale: "); Serial.println(prescaleval); + uint8_t prescale = floor(prescaleval + 0.5); + //Serial.print("Final pre-scale: "); Serial.println(prescale); + + uint8_t oldmode = read8(PCA9685_MODE1); + uint8_t newmode = (oldmode&0x7F) | 0x10; // sleep + write8(PCA9685_MODE1, newmode); // go to sleep + write8(PCA9685_PRESCALE, prescale); // set the prescaler + write8(PCA9685_MODE1, oldmode); + delay(5); + write8(PCA9685_MODE1, oldmode | 0xa1); // This sets the MODE1 register to turn on auto increment. + // This is why the beginTransmission below was not working. + // Serial.print("Mode now 0x"); Serial.println(read8(PCA9685_MODE1), HEX); +} + +void Adafruit_MS_PWMServoDriver::setPWM(uint8_t num, uint16_t on, uint16_t off) { + //Serial.print("Setting PWM "); Serial.print(num); Serial.print(": "); Serial.print(on); Serial.print("->"); Serial.println(off); + + WIRE.beginTransmission(_i2caddr); +#if ARDUINO >= 100 + WIRE.write(LED0_ON_L+4*num); + WIRE.write(on); + WIRE.write(on>>8); + WIRE.write(off); + WIRE.write(off>>8); +#else + WIRE.send(LED0_ON_L+4*num); + WIRE.send((uint8_t)on); + WIRE.send((uint8_t)(on>>8)); + WIRE.send((uint8_t)off); + WIRE.send((uint8_t)(off>>8)); +#endif + WIRE.endTransmission(); +} + +uint8_t Adafruit_MS_PWMServoDriver::read8(uint8_t addr) { + WIRE.beginTransmission(_i2caddr); +#if ARDUINO >= 100 + WIRE.write(addr); +#else + WIRE.send(addr); +#endif + WIRE.endTransmission(); + + WIRE.requestFrom((uint8_t)_i2caddr, (uint8_t)1); +#if ARDUINO >= 100 + return WIRE.read(); +#else + return WIRE.receive(); +#endif +} + +void Adafruit_MS_PWMServoDriver::write8(uint8_t addr, uint8_t d) { + WIRE.beginTransmission(_i2caddr); +#if ARDUINO >= 100 + WIRE.write(addr); + WIRE.write(d); +#else + WIRE.send(addr); + WIRE.send(d); +#endif + WIRE.endTransmission(); +} diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.h b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.h new file mode 100644 index 0000000..359e8e1 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/Adafruit_MS_PWMServoDriver.h @@ -0,0 +1,61 @@ +/*************************************************** + This is a library for our Adafruit 16-channel PWM & Servo driver + + Pick one up today in the adafruit shop! + ------> http://www.adafruit.com/products/815 + + These displays use I2C to communicate, 2 pins are required to + interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 + + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ****************************************************/ + +#ifndef _Adafruit_MS_PWMServoDriver_H +#define _Adafruit_MS_PWMServoDriver_H + +#if ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + + +#define PCA9685_SUBADR1 0x2 +#define PCA9685_SUBADR2 0x3 +#define PCA9685_SUBADR3 0x4 + +#define PCA9685_MODE1 0x0 +#define PCA9685_PRESCALE 0xFE + +#define LED0_ON_L 0x6 +#define LED0_ON_H 0x7 +#define LED0_OFF_L 0x8 +#define LED0_OFF_H 0x9 + +#define ALLLED_ON_L 0xFA +#define ALLLED_ON_H 0xFB +#define ALLLED_OFF_L 0xFC +#define ALLLED_OFF_H 0xFD + + +class Adafruit_MS_PWMServoDriver { + public: + Adafruit_MS_PWMServoDriver(uint8_t addr = 0x40); + void begin(void); + void reset(void); + void setPWMFreq(float freq); + void setPWM(uint8_t num, uint16_t on, uint16_t off); + + private: + uint8_t _i2caddr; + + uint8_t read8(uint8_t addr); + void write8(uint8_t addr, uint8_t d); +}; + +#endif diff --git a/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/license.txt b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/license.txt new file mode 100644 index 0000000..f6a0f22 --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/Adafruit Motor Shield V2 Library/utility/license.txt @@ -0,0 +1,26 @@ +Software License Agreement (BSD License) + +Copyright (c) 2012, Adafruit Industries +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holders nor the +names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/shields/Adafruit Motor Shield v2.3/Data Sheet Motor Driver TB6612FNG.pdf b/shields/Adafruit Motor Shield v2.3/Data Sheet Motor Driver TB6612FNG.pdf new file mode 100644 index 0000000..a741b4c Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/Data Sheet Motor Driver TB6612FNG.pdf differ diff --git a/shields/Adafruit Motor Shield v2.3/Motor Shield Schematics.png b/shields/Adafruit Motor Shield v2.3/Motor Shield Schematics.png new file mode 100644 index 0000000..890cfce Binary files /dev/null and b/shields/Adafruit Motor Shield v2.3/Motor Shield Schematics.png differ diff --git a/shields/Adafruit Motor Shield v2.3/readme.md b/shields/Adafruit Motor Shield v2.3/readme.md new file mode 100644 index 0000000..838400d --- /dev/null +++ b/shields/Adafruit Motor Shield v2.3/readme.md @@ -0,0 +1,13 @@ +Adafruit Motor Shield V2 +======================== + +Detailed information on the Adafruit Motor Shield V2 can be found on the [product website](https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino). + +Content: + + - Adafruit Motor Shield V2 Library + software library for the Shield + - AccelStepper Library + additional software for controlling stepper motors + - Motor Shield Schematics.png + - Data Sheet Motor Driver TB6612FNG.pdf diff --git a/shields/Data Logger Shield mSD/mSD-Shield_v20.pdf b/shields/Data Logger Shield mSD/mSD-Shield_v20.pdf new file mode 100644 index 0000000..b302023 Binary files /dev/null and b/shields/Data Logger Shield mSD/mSD-Shield_v20.pdf differ diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/README.md b/shields/Data Logger Shield mSD/mSD_Shield Library/README.md new file mode 100644 index 0000000..effc3a4 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/README.md @@ -0,0 +1,28 @@ +# mSD-Shield + +## Schematics +The schematics can be found [here](https://github.com/watterott/mSD-Shield#msd-shield). + +## Examples +Examples can be found in the Arduino IDE under ```File -> Examples -> mSD_Shield``` and ```File -> Examples -> SD```. + +## mSD-Shield + Ethernet-Shield +If using the Ethernet-Shield together with the mSD-Shield, this must be initialized before using the SD-Card. Because otherwise the W5100 Ethernet controller blocks the SPI interface. + +## mSD-Shield v2 +The mSD-Shield v2 uses the ICSP connector for the SPI signals and so all Arduino boards can be used. + +## mSD-Shield v1 (not mSD-Shield Mega-Edition) +For Hardware-SPI support on Mega boards connect the mSD-Shield v1 as follows. +No Software changes are required. + + Mega mSD-Shield v1 + SCK 52 -> 13 + MOSI 51 -> 11 + MISO 50 -> 12 + +For using the RTC on Mega boards the I2C pins have to be changed. + + Mega mSD-Shield v1 + SDA 20 -> A4 + SCL 21 -> A5 diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/BMPDemo.ino b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/BMPDemo.ino new file mode 100644 index 0000000..0825129 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/BMPDemo.ino @@ -0,0 +1,113 @@ +/* + BMP-File Demonstration + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//Declare only one display ! +// MI0283QT2 lcd; //MI0283QT2 Adapter v1 +// MI0283QT9 lcd; //MI0283QT9 Adapter v1 +// DisplaySPI lcd; //SPI (GLCD-Shield or MI0283QT Adapter v2) + DisplayI2C lcd; //I2C (GLCD-Shield or MI0283QT Adapter v2) + + +uint8_t OpenBMPFile(char *file, int16_t x, int16_t y) +{ + File myFile; + uint8_t buf[40]; //read buf (min. size = sizeof(BMP_DIPHeader)) + BMP_Header *bmp_hd; + BMP_DIPHeader *bmp_dip; + int16_t width, height, w, h; + uint8_t pad, result=0; + + //open file + myFile = SD.open(file); + if(myFile) + { + result = 1; + //BMP Header + myFile.read(&buf, sizeof(BMP_Header)); + bmp_hd = (BMP_Header*)&buf[0]; + if((bmp_hd->magic[0] == 'B') && (bmp_hd->magic[1] == 'M') && (bmp_hd->offset == 54)) + { + result = 2; + //BMP DIP-Header + myFile.read(&buf, sizeof(BMP_DIPHeader)); + bmp_dip = (BMP_DIPHeader*)&buf[0]; + if((bmp_dip->size == sizeof(BMP_DIPHeader)) && (bmp_dip->bitspp == 24) && (bmp_dip->compress == 0)) + { + result = 3; + //BMP Data (1. pixel = bottom left) + width = bmp_dip->width; + height = bmp_dip->height; + pad = width % 4; //padding (line is multiply of 4) + if((x+width) <= lcd.getWidth() && (y+height) <= lcd.getHeight()) + { + result = 4; + lcd.setArea(x, y, x+width-1, y+height-1); + for(h=(y+height-1); h >= y; h--) //for every line + { + for(w=x; w < (x+width); w++) //for every pixel in line + { + myFile.read(&buf, 3); + lcd.drawPixel(w, h, RGB(buf[2],buf[1],buf[0])); + } + if(pad) + { + myFile.read(&buf, pad); + } + } + } + else + { + lcd.drawText(x, y, "Pic out of screen!", RGB(0,0,0), RGB(255,255,255), 1); + } + } + } + + myFile.close(); + } + + return result; +} + + +void setup() +{ + int x, i; + + //init Display + lcd.begin(); + //lcd.begin(SPI_CLOCK_DIV4, 8); //SPI Displays: spi-clk=Fcpu/4, rst-pin=8 + //lcd.begin(0x20, 8); //I2C Displays: addr=0x20, rst-pin=8 + lcd.fillScreen(RGB(255,255,255)); + + //init SD-Card + x = lcd.drawText(5, 5, "Init SD-Card...", RGB(0,0,0), RGB(255,255,255), 1); + if(!SD.begin(4)) //cs-pin=4 + { + lcd.drawText(x, 5, "failed", RGB(0,0,0), RGB(255,255,255), 1); + while(1); + } + + //open windows bmp file (24bit RGB) + x = lcd.drawText(5, 5, "Open File...", RGB(0,0,0), RGB(255,255,255), 1); + i = OpenBMPFile("image.bmp", 20, 20); + lcd.drawInteger(x, 5, i, 10, RGB(0,0,0), RGB(255,255,255), 1); +} + + +void loop() +{ + //do nothing +} diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/image.bmp b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/image.bmp new file mode 100644 index 0000000..09c670a Binary files /dev/null and b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/BMPDemo/image.bmp differ diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/examples/DataLogger/DataLogger.ino b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/DataLogger/DataLogger.ino new file mode 100644 index 0000000..6affcdd --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/DataLogger/DataLogger.ino @@ -0,0 +1,93 @@ +/* + Data Logger Example + */ + +#include +#include +#include +#include + + +DS1307 rtc; + + +void setup() +{ + int x; + + //init Serial port + Serial.begin(9600); + while(!Serial); //wait for serial port to connect - needed for Leonardo only + + //init RTC + Serial.print("Init RTC..."); + //only set the date+time one time + // rtc.set(0, 0, 8, 24, 12, 2014); //08:00:00 24.12.2014 //sec, min, hour, day, month, year + rtc.start(); + Serial.println("ok"); + + //init SD-Card + Serial.print("Init SD-Card..."); + if(!SD.begin(4)) //cs-pin=4 + { + Serial.println("failed"); + while(1); + } + else + { + Serial.println("ok"); + } + + Serial.println("Start logging..."); +} + + +void loop() +{ + String dataString = ""; //string for logging data + int sec, min, hour, day, month, year; + + //get time from RTC + rtc.get(&sec, &min, &hour, &day, &month, &year); + dataString += String(hour); + dataString += ":"; + dataString += String(min); + dataString += ":"; + dataString += String(sec); + dataString += ";"; + dataString += String(year); + dataString += "-"; + dataString += String(month); + dataString += "-"; + dataString += String(day); + dataString += ";"; + + //read analog input 0,1,2 + for(int analogPin=0; analogPin < 3; analogPin++) + { + int sensor = analogRead(analogPin); + dataString += String(sensor); + if(analogPin < 2) + { + dataString += ","; + } + } + + //print data to the serial port + Serial.println(dataString); + + //open data file from SD card + File dataFile = SD.open("datalog.txt", FILE_WRITE); + if(dataFile) //file opened successfully + { + dataFile.println(dataString); + dataFile.close(); + } + else + { + Serial.println("Error opening datalog.txt"); + } + + //wait 1 second + delay(1000); +} diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/examples/RTC/RTC.ino b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/RTC/RTC.ino new file mode 100644 index 0000000..d782b81 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/RTC/RTC.ino @@ -0,0 +1,79 @@ +/* + RTC (Real-Time-Clock) Example + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//Declare only one display ! +// MI0283QT2 lcd; //MI0283QT2 Adapter v1 +// MI0283QT9 lcd; //MI0283QT9 Adapter v1 +// DisplaySPI lcd; //SPI (GLCD-Shield or MI0283QT Adapter v2) + DisplayI2C lcd; //I2C (GLCD-Shield or MI0283QT Adapter v2) + +DS1307 rtc; + + +void setup() +{ + //init Serial port + Serial.begin(9600); + while(!Serial); //wait for serial port to connect - needed for Leonardo only + + //init Display + Serial.println("Init Display..."); + lcd.begin(); + //lcd.begin(SPI_CLOCK_DIV4, 8); //SPI Displays: spi-clk=Fcpu/4, rst-pin=8 + //lcd.begin(0x20, 8); //I2C Displays: addr=0x20, rst-pin=8 + lcd.fillScreen(RGB(255,255,255)); + + //init RTC + Serial.println("Init RTC..."); + //only set the date+time one time + // rtc.set(0, 0, 8, 24, 12, 2014); //08:00:00 24.12.2014 //sec, min, hour, day, month, year + rtc.start(); +} + + +void loop() +{ + uint8_t sec, min, hour, day, month; + uint16_t year; + char buf[16]; + + //get time from RTC + rtc.get(&sec, &min, &hour, &day, &month, &year); + + //serial output + Serial.print("\nTime: "); + Serial.print(hour, DEC); + Serial.print(":"); + Serial.print(min, DEC); + Serial.print(":"); + Serial.print(sec, DEC); + + Serial.print("\nDate: "); + Serial.print(day, DEC); + Serial.print("."); + Serial.print(month, DEC); + Serial.print("."); + Serial.print(year, DEC); + + //display output + sprintf(buf, "%02i : %02i : %02i", hour, min, sec); + lcd.drawText(10, 5, buf, RGB(0,0,0), RGB(255,255,255), 1); + + sprintf(buf, "%02i . %02i . %04i", day, month, year); + lcd.drawText(10, 20, buf, RGB(0,0,0), RGB(255,255,255), 1); + + //wait a second + delay(1000); +} diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/examples/ReadWrite/ReadWrite.ino b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/ReadWrite/ReadWrite.ino new file mode 100644 index 0000000..5651b80 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/examples/ReadWrite/ReadWrite.ino @@ -0,0 +1,96 @@ +/* + Read/Write File Example + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//Declare only one display ! +// MI0283QT2 lcd; //MI0283QT2 Adapter v1 +// MI0283QT9 lcd; //MI0283QT9 Adapter v1 +// DisplaySPI lcd; //SPI (GLCD-Shield or MI0283QT Adapter v2) + DisplayI2C lcd; //I2C (GLCD-Shield or MI0283QT Adapter v2) + +File myFile; + + +void setup() +{ + int x; + + //init Serial port + Serial.begin(9600); + while(!Serial); //wait for serial port to connect - needed for Leonardo only + + //init LCD + Serial.println("Init Display..."); + lcd.begin(); + //lcd.begin(SPI_CLOCK_DIV4, 8); //SPI Displays: spi-clk=Fcpu/4, rst-pin=8 + //lcd.begin(0x20, 8); //I2C Displays: addr=0x20, rst-pin=8 + lcd.fillScreen(RGB(255,255,255)); + + //init SD-Card + Serial.println("Init SD-Card..."); + x = lcd.drawText(5, 5, "Init SD-Card...", RGB(0,0,0), RGB(255,255,255), 1); + if(!SD.begin(4)) //cs-pin=4 + { + Serial.println("failed"); + lcd.drawText(x, 5, "failed", RGB(0,0,0), RGB(255,255,255), 1); + while(1); + } + + //open file for writing + Serial.println("Open File..."); + x = lcd.drawText(5, 5, "Open File...", RGB(0,0,0), RGB(255,255,255), 1); + myFile = SD.open("test.txt", FILE_WRITE); + if(myFile) + { + Serial.println("Writing..."); + lcd.drawText(5, 5, "Writing...", RGB(0,0,0), RGB(255,255,255), 1); + myFile.println("This is a Test: ABC 123"); + myFile.close(); + } + else + { + Serial.println("error"); + lcd.drawText(x, 5, "error", RGB(0,0,0), RGB(255,255,255), 1); + } + + //open file for reading + Serial.println("Open File..."); + x = lcd.drawText(5, 5, "Open File...", RGB(0,0,0), RGB(255,255,255), 1); + myFile = SD.open("test.txt"); + if(myFile) + { + Serial.println("Reading..."); + lcd.drawText(x, 5, "Reading...", RGB(0,0,0), RGB(255,255,255), 1); + lcd.setCursor(0, 20); + while(myFile.available()) + { + uint8_t c; + c = myFile.read(); + Serial.write(c); + lcd.print((char)c); + } + myFile.close(); + } + else + { + Serial.println("error"); + lcd.drawText(x, 5, "error", RGB(0,0,0), RGB(255,255,255), 1); + } +} + + +void loop() +{ + //do nothing +} diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/library.json b/shields/Data Logger Shield mSD/mSD_Shield Library/library.json new file mode 100644 index 0000000..6c03b72 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/library.json @@ -0,0 +1,13 @@ +{ + "name": "mSD_Shield", + "keywords": "microsd, rtc, display, logging", + "description": "mSD-Shield (Display, microSD, RTC)", + "include": "mSD_Shield", + "repository": + { + "type": "git", + "url": "https://github.com/watterott/Arduino-Libs.git" + }, + "frameworks": "arduino", + "platforms": "atmelavr" +} diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/library.properties b/shields/Data Logger Shield mSD/mSD_Shield Library/library.properties new file mode 100644 index 0000000..d5bf2fa --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/library.properties @@ -0,0 +1,9 @@ +name=mSD_Shield +version=1.0.0 +author=Watterott +maintainer=Watterott +sentence=mSD-Shield (Display, microSD, RTC) +paragraph=mSD-Shield (Display, microSD, RTC) +category=Communication +url=https://github.com/watterott/Arduino-Libs +architectures=* diff --git a/shields/Data Logger Shield mSD/mSD_Shield Library/mSD_Shield.h b/shields/Data Logger Shield mSD/mSD_Shield Library/mSD_Shield.h new file mode 100644 index 0000000..aa57bf3 --- /dev/null +++ b/shields/Data Logger Shield mSD/mSD_Shield Library/mSD_Shield.h @@ -0,0 +1 @@ +//empty file, workaround for libraries containing only examples diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.cpp b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.cpp new file mode 100644 index 0000000..1b8e7c3 --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.cpp @@ -0,0 +1,230 @@ +/* + RV8523 RTC Lib for Arduino + by Watterott electronic (www.watterott.com) + */ + +#include +#if defined(__AVR__) +# include +#endif +#if ARDUINO >= 100 +# include "Arduino.h" +#else +# include "WProgram.h" +#endif +#include "Wire.h" +#include "RV8523.h" + + +#define I2C_ADDR (0xD0>>1) + + +//-------------------- Constructor -------------------- + + +RV8523::RV8523(void) +{ + Wire.begin(); + + return; +} + + +//-------------------- Public -------------------- + + +void RV8523::start(void) +{ + uint8_t val; + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.endTransmission(); + Wire.requestFrom(I2C_ADDR, 1); + val = Wire.read(); + + if(val & (1<<5)) + { + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.write(val & ~(1<<5)); //clear STOP (bit 5) + Wire.endTransmission(); + } + + return; +} + + +void RV8523::stop(void) +{ + uint8_t val; + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.endTransmission(); + Wire.requestFrom(I2C_ADDR, 1); + val = Wire.read(); + + if(!(val & (1<<5))) + { + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.write(val | (1<<5)); //set STOP (bit 5) + Wire.endTransmission(); + } + + return; +} + + +void RV8523::set12HourMode(void) //set 12 hour mode +{ + uint8_t val; + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.endTransmission(); + Wire.requestFrom(I2C_ADDR, 1); + val = Wire.read(); + + if(!(val & (1<<3))) + { + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.write(val | (1<<3)); //set 12 hour mode (bit 3) + Wire.endTransmission(); + } + + return; +} + + +void RV8523::set24HourMode(void) //set 24 hour mode +{ + uint8_t val; + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.endTransmission(); + Wire.requestFrom(I2C_ADDR, 1); + val = Wire.read(); + + if(val & (1<<3)) + { + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x00)); //control 1 + Wire.write(val & ~(1<<3)); //set 12 hour mode (bit 3) + Wire.endTransmission(); + } + + return; +} + + +void RV8523::batterySwitchOver(int on) //activate/deactivate battery switch over mode +{ + uint8_t val; + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x02)); //control 3 + Wire.endTransmission(); + Wire.requestFrom(I2C_ADDR, 1); + val = Wire.read(); + if(val & 0xE0) + { + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x02)); //control 3 + if(on) + { + Wire.write(val & ~0xE0); //battery switchover in standard mode + } + else + { + Wire.write(val | 0xE0); //battery switchover disabled + } + Wire.endTransmission(); + } + + return; +} + + +void RV8523::get(uint8_t *sec, uint8_t *min, uint8_t *hour, uint8_t *day, uint8_t *month, uint16_t *year) +{ + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x03)); + Wire.endTransmission(); + + Wire.requestFrom(I2C_ADDR, 7); + *sec = bcd2bin(Wire.read() & 0x7F); + *min = bcd2bin(Wire.read() & 0x7F); + *hour = bcd2bin(Wire.read() & 0x3F); //24 hour mode + *day = bcd2bin(Wire.read() & 0x3F); + bcd2bin(Wire.read() & 0x07); //day of week + *month = bcd2bin(Wire.read() & 0x1F); + *year = bcd2bin(Wire.read()) + 2000; + + return; +} + + +void RV8523::get(int *sec, int *min, int *hour, int *day, int *month, int *year) +{ + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x03)); + Wire.endTransmission(); + + Wire.requestFrom(I2C_ADDR, 7); + *sec = bcd2bin(Wire.read() & 0x7F); + *min = bcd2bin(Wire.read() & 0x7F); + *hour = bcd2bin(Wire.read() & 0x3F); //24 hour mode + *day = bcd2bin(Wire.read() & 0x3F); + bcd2bin(Wire.read() & 0x07); //day of week + *month = bcd2bin(Wire.read() & 0x1F); + *year = bcd2bin(Wire.read()) + 2000; + + return; +} + + +void RV8523::set(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year) +{ + if(year > 2000) + { + year -= 2000; + } + + Wire.beginTransmission(I2C_ADDR); + Wire.write(byte(0x03)); + Wire.write(bin2bcd(sec)); + Wire.write(bin2bcd(min)); + Wire.write(bin2bcd(hour)); + Wire.write(bin2bcd(day)); + Wire.write(bin2bcd(0)); + Wire.write(bin2bcd(month)); + Wire.write(bin2bcd(year)); + Wire.endTransmission(); + + return; +} + + +void RV8523::set(int sec, int min, int hour, int day, int month, int year) +{ + return set((uint8_t)sec, (uint8_t)min, (uint8_t)hour, (uint8_t)day, (uint8_t)month, (uint16_t)year); +} + + +//-------------------- Private -------------------- + + +uint8_t RV8523::bin2bcd(uint8_t val) +{ + return val + 6 * (val / 10); +} + + +uint8_t RV8523::bcd2bin(uint8_t val) +{ + return val - 6 * (val >> 4); +} diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.h b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.h new file mode 100644 index 0000000..0f83dbb --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/RV8523.h @@ -0,0 +1,29 @@ +#ifndef RV8523_h +#define RV8523_h + + +#include + + +class RV8523 +{ + public: + RV8523(); + + void start(void); + void stop(void); + void get(uint8_t *sec, uint8_t *min, uint8_t *hour, uint8_t *day, uint8_t *month, uint16_t *year); + void get(int *sec, int *min, int *hour, int *day, int *month, int *year); + void set(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year); + void set(int sec, int min, int hour, int day, int month, int year); + void set12HourMode(void); + void set24HourMode(void); + void batterySwitchOver(int on); + + private: + uint8_t bin2bcd(uint8_t val); + uint8_t bcd2bin(uint8_t val); +}; + + +#endif //RV8523_h diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/Example/Example.ino b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/Example/Example.ino new file mode 100644 index 0000000..6dc531f --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/Example/Example.ino @@ -0,0 +1,75 @@ +/* + RV8523 RTC (Real-Time-Clock) Example + + Uno A4 (SDA), A5 (SCL) + Mega 20 (SDA), 21 (SCL) + Leonardo 2 (SDA), 3 (SCL) + + Note: To enable the I2C pull-up resistors on the RTC-Breakout, the jumper J1 has to be closed. + */ + +#include +#include + + +RV8523 rtc; + + +void setup() +{ + //init Serial port + Serial.begin(9600); + while(!Serial); //wait for serial port to connect - needed for Leonardo only + + //init RTC + Serial.println("Init RTC..."); + + //set 12 hour mode + // rtc.set12HourMode(); + + //set 24 hour mode + // rtc.set24HourMode(); + + //set the date+time (only one time) + // rtc.set(0, 0, 8, 24, 12, 2014); //08:00:00 24.12.2014 //sec, min, hour, day, month, year + + //stop/pause RTC + // rtc.stop(); + + //start RTC + rtc.start(); + + //When the power source is removed, the RTC will keep the time. + rtc.batterySwitchOver(1); //battery switch over on + + //When the power source is removed, the RTC will not keep the time. + // rtc.batterySwitchOver(0); //battery switch over off +} + + +void loop() +{ + uint8_t sec, min, hour, day, month; + uint16_t year; + + //get time from RTC + rtc.get(&sec, &min, &hour, &day, &month, &year); + + //serial output + Serial.print("\nTime: "); + Serial.print(hour, DEC); + Serial.print(":"); + Serial.print(min, DEC); + Serial.print(":"); + Serial.print(sec, DEC); + + Serial.print("\nDate: "); + Serial.print(day, DEC); + Serial.print("."); + Serial.print(month, DEC); + Serial.print("."); + Serial.print(year, DEC); + + //wait a second + delay(1000); +} diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/SetClock/SetClock.ino b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/SetClock/SetClock.ino new file mode 100644 index 0000000..a6ac999 --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/examples/SetClock/SetClock.ino @@ -0,0 +1,150 @@ +/* + RV8523 RTC (Real-Time-Clock) Set Clock Example + + Uno A4 (SDA), A5 (SCL) + Mega 20 (SDA), 21 (SCL) + Leonardo 2 (SDA), 3 (SCL) + + Note: To enable the I2C pull-up resistors on the RTC-Breakout, the jumper J1 has to be closed. + + This sketch allows to set the time using the serial console. On linux use a command like: + + stty -F /dev/ttyUSB1 speed 9600 + date '+T%H%M%S%d%m%Y' > /dev/ttyUSB1 + + to read the current local time from the serial console. Or just type a string like + + T23595924122015 + + to set the clock to 23:59:59 24th of December 2015 using Arduinos/Genuinos serial monitor. + + Type an arbitary string not beginning with 'T' to show the current time. + */ + +#include +#include + + +#define BUFF_MAX 32 + +RV8523 rtc; +unsigned int recv_size = 0; +char recv[BUFF_MAX]; + + +void setup() +{ + //init Serial port + Serial.begin(9600); + while(!Serial); //wait for serial port to connect - needed for Leonardo only + + //init RTC + Serial.println("Init RTC..."); + + //set 24 hour mode + rtc.set24HourMode(); + + //start RTC + rtc.start(); + + //When the power source is removed, the RTC will keep the time. + rtc.batterySwitchOver(1); //battery switch over on +} + + +void loop() +{ + if (Serial.available() > 0) { + setClock(); + } +} + + +void setClock() +{ + char in; + + in = Serial.read(); + Serial.print(in); + + if((in == 10 || in == 13) && (recv_size > 0)) + { + parseCmd(recv, recv_size); + printTime(); + recv_size = 0; + recv[0] = 0; + return; + } + else if (in < 48 || in > 122) //ignore ~[0-9A-Za-z] + { + //do nothing + } + else if (recv_size > BUFF_MAX - 2) //drop lines that are too long + { + recv_size = 0; + recv[0] = 0; + } + else if (recv_size < BUFF_MAX - 2) + { + recv[recv_size] = in; + recv[recv_size + 1] = 0; + recv_size += 1; + } +} + + +// Parse the time string and set the clock accordingly +void parseCmd(char *cmd, int cmdsize) +{ + uint8_t i; + uint8_t reg_val; + char buff[BUFF_MAX]; + + //ThhmmssDDMMYYYY aka set time + if (cmd[0] == 84 && cmdsize == 15) + { + rtc.set( + inp2toi(cmd, 5), + inp2toi(cmd, 3), + inp2toi(cmd, 1), + inp2toi(cmd, 7), + inp2toi(cmd, 9), + inp2toi(cmd, 11) * 100 + inp2toi(cmd, 13) + ); //sec, min, hour, day, month, year + Serial.println("OK"); + } +} + + +// just output the time +void printTime() +{ + uint8_t sec, min, hour, day, month; + uint16_t year; + + //get time from RTC + rtc.get(&sec, &min, &hour, &day, &month, &year); + + //serial output + Serial.print("\nTime: "); + Serial.print(hour, DEC); + Serial.print(":"); + Serial.print(min, DEC); + Serial.print(":"); + Serial.print(sec, DEC); + + Serial.print("\nDate: "); + Serial.print(day, DEC); + Serial.print("."); + Serial.print(month, DEC); + Serial.print("."); + Serial.print(year, DEC); +} + + +uint8_t inp2toi(char *cmd, const uint16_t seek) +{ + uint8_t rv; + rv = (cmd[seek] - 48) * 10 + cmd[seek + 1] - 48; + return rv; +} diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.json b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.json new file mode 100644 index 0000000..b06c48e --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.json @@ -0,0 +1,13 @@ +{ + "name": "RV8523", + "keywords": "i2c, rtc, time, clock", + "description": "RV-8523 RTC (Real-Time-Clock)", + "include": "RV8523", + "repository": + { + "type": "git", + "url": "https://github.com/watterott/Arduino-Libs.git" + }, + "frameworks": "arduino", + "platforms": "atmelavr" +} diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.properties b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.properties new file mode 100644 index 0000000..d468b73 --- /dev/null +++ b/shields/Real Time Clock RV 8523 Breakout/RV8523 Library/library.properties @@ -0,0 +1,9 @@ +name=RV8523 +version=1.0.0 +author=Watterott +maintainer=Watterott +sentence=RV-8523 RTC (Real-Time-Clock) +paragraph=RV-8523 RTC (Real-Time-Clock) +category=Timing +url=https://github.com/watterott/Arduino-Libs +architectures=* diff --git a/shields/Real Time Clock RV 8523 Breakout/RV8523-RTC-Breakout_v10.pdf b/shields/Real Time Clock RV 8523 Breakout/RV8523-RTC-Breakout_v10.pdf new file mode 100644 index 0000000..e71d1fe Binary files /dev/null and b/shields/Real Time Clock RV 8523 Breakout/RV8523-RTC-Breakout_v10.pdf differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/High_Level_Control3.jpg b/shields/Seeeed Studio Relay Shield v3/img/High_Level_Control3.jpg new file mode 100644 index 0000000..bd1cd69 Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/High_Level_Control3.jpg differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Low_Level_Control4.jpg b/shields/Seeeed Studio Relay Shield v3/img/Low_Level_Control4.jpg new file mode 100644 index 0000000..4a353cd Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Low_Level_Control4.jpg differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Motor-shield-schematic-drawing.png b/shields/Seeeed Studio Relay Shield v3/img/Motor-shield-schematic-drawing.png new file mode 100644 index 0000000..3ce005e Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Motor-shield-schematic-drawing.png differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_Connector.jpg b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_Connector.jpg new file mode 100644 index 0000000..b97086a Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_Connector.jpg differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_L_v3.0.jpg b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_L_v3.0.jpg new file mode 100644 index 0000000..bb8abef Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_L_v3.0.jpg differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_v3.0.png b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_v3.0.png new file mode 100644 index 0000000..845ba8b Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Relay_Shield_v3.0.png differ diff --git a/shields/Seeeed Studio Relay Shield v3/img/Two-relay-shields-one-arduino.png b/shields/Seeeed Studio Relay Shield v3/img/Two-relay-shields-one-arduino.png new file mode 100644 index 0000000..b9c5d6e Binary files /dev/null and b/shields/Seeeed Studio Relay Shield v3/img/Two-relay-shields-one-arduino.png differ diff --git a/shields/Seeeed Studio Relay Shield v3/readme.md b/shields/Seeeed Studio Relay Shield v3/readme.md new file mode 100644 index 0000000..1b375e4 --- /dev/null +++ b/shields/Seeeed Studio Relay Shield v3/readme.md @@ -0,0 +1,163 @@ +--- +title: Relay Shield v3.0 +category: Arduino +bzurl: https://www.seeedstudio.com/Relay-Shield-v3.0-p-2440.html +oldwikiname: Relay Shield v3.0 +prodimagename: Relay_Shield_L_v3.0.jpg +surveyurl: https://www.surveymonkey.com/r/relay-shiel-v3 +sku: 103030009 +--- + +--- +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Relay_Shield_L_v3.0.jpg) + +The Relay Shield provides a solution for controlling high current devices that cannot be controlled by the Arduino’s Digital I/O pins due to their current and voltage limits. +The Relay Shield features four high quality relays and provides NO/NC interfaces, four dynamic LED indicators to show the on/off state of each relay, and the standardized shield form factor to provide a smooth connection to the Arduino/Seeeduino board or other Arduino compatible boards. + +[![](https://github.com/SeeedDocument/Seeed-WiKi/raw/master/docs/images/300px-Get_One_Now_Banner-ragular.png)](https://www.seeedstudio.com/Relay-Shield-v3.0-p-2440.html) + + +## Features +--- +- Arudino Uno/Leonardo/Seeeduino compatible; Other board or microcontroller via jumper cables +- Interface via digital I/O pins 4,5,6, and 7 +- Relay screw terminals +- Standardized shield shape and design +- LED working status indicators for each relay +- High quality relays +- COM, NO (Normally Open), and NC (Normally Closed) relay pins for each relay +- Update pin SCL, SDA, IOREF, NC. + +## Specification + +|Item| Min |Typical |Max |Unit| +|---|:---:|:---:|:---:|:---:| +|Supply Voltage |4.75 |5| 5.25 |VDC| +|Working Current |8| /| 250| mA| +|Switching Voltage| /| /| 35| VDC| +|Switching Current| /| /| 8|A| +|Frequency| /| 1| /| HZ| +|Switching Power| /| /| 70| W| +|Relay Life| 100,000| /| /| Cycle| +|ESD contact discharge|- |±4 |-|KV| +|ESD air discharge|-| ±8|-| KV| +|Dimension|-| 68.7X53.5X30.8|-| mm| +|Net Weight|-| 55±2|-| g| + +!!!Cautions + Place 2 layers of electrical tape on the top of the Arduino's usb connector. This will prevent the relay shield from making contact. Do not operate voltage more than 35V DC. + +## Shield Interface Description +--- + +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Relay_Shield_v3.0.png) + +- Digital 4 – controls RELAY4’s COM4 pin (located in J4) +- Digital 5 – controls RELAY3’s COM3 pin (located in J3) +- Digital 6 – controls RELAY2’s COM2 pin (located in J2) +- Digital 7 – controls RELAY1’s COM1 pin (located in J1) + +**J1 Interface/Terminal Pin Description:** +- **COM1 (Common Pin)** : The relay pin controlled from the digital pin. +- **NC1 (Normally Closed)**: This terminal will be connected to COM1 when the RELAY1 control pin (Digital 7 I/O pin) is set low and disconnected when the RELAY1 control pin is set high. +- **NO1 (Normally Open)**: This terminal will be connected to COM1 when the RELAY1 control pin (Digital 7 I/O pin) is set high and disconnected when the RELAY1 control pin is set low. + +**Terminals J2-4 are similar to J1 except that they control RELAY2-RELAY4 respectively. ** + +!!!Note + Only four Arduino Digital I/O pins, pins 4-7, are required to control the four different relays. Additionally the 5V and two GND Arduino pins are also required to power up the Relay Shield. + +## Relays Operation/Tutorial +--- +Relays are basically electromagnetic switches: when the relay is energized by the control circuit (i.e. when a voltage and current is applied to the coil), the current and coil create a magnetic field which is able to attract the COM terminal towards the NO terminal, when the control circuit removes the applied voltage and current the COM terminal returns to contact the NC terminal due to a mechanical force (usually a spring). + +Some practical relay applications include: control of high voltage using low voltage, motor control, remote control, anti-hearing alarm, automatic temperature alarm, incubators and son on. + +A motor control application with one relay and one motor is shown below: +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Low_Level_Control4.jpg) + +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/High_Level_Control3.jpg) + +In the case of the Relay Shield, the two “Control Circuit” terminals for each of the four relays are controlled by only one Arduino Digital I/O pin. Pins 4, 5, 6, and 7 control relays 4, 3, 2, and 1 respectively. + +## Relay Shield Example(s)/Usage + +Now that you know how a relay works internally, let us show you how to use the Relay Shield. + +**Example #1: DC Motor Control** + +1.Stack the Relay Shield onto the Arduino development board. + +2.Connect the Arduino to the PC using a USB cable. + +3.We will use RELAY3 to control the DC motor. Connect the DC motor and Relay Shield as shown in the schematic and figure below: + +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Motor-shield-schematic-drawing.png) + +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Relay_Shield_Connector.jpg) + +!!!Note + The external power supply in the figure above can be a battery or power supply. The external supply must be able to provide enough current and be set to the correct voltage for the motor. In our testing, we used a lithium battery as the external power supply for the motor. + +4.Start the Arduino IDE and upload the following code to the Arduino board: +``` +int MotorControl = 5; // Digital Arduino Pin used to control the motor + +// the setup routine runs once when you press reset: +void setup() { + // declare pin 5 to be an output: + pinMode(MotorControl, OUTPUT); +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(MotorControl,HIGH);// NO3 and COM3 Connected (the motor is running) + delay(1000); // wait 1000 milliseconds (1 second) + digitalWrite(MotorControl,LOW);// NO3 and COM3 Disconnected (the motor is not running) + delay(1000); // wait 1000 milliseconds (1 second) +} +``` + +When you have uploaded the code to your Arduino/Seeeduino board the motor should run one second, stop for another second and repeat the process indefinitely. When the motor is running (NO3 and COM3 are connected), the NO3 LED indicator will be lit. + +**Example #2: How to Use More Than One Relay Shield With Only One Arduino/Seeeduino Board** + +Because the Relay Shield uses digital pins on the Arduino to control each the relays, more than one Relay Shield can be used with the same Arduino board, to do so simply follow these steps: + +1.Stack one of the Relay Shields (let’s call this one Relay Shield #1) onto the Arduino development board + +2.Connect another Relay Shield (let’s call this one Relay Shield #2) using jumper cables/wires to Relay Shield #1 as shown in the figure below: + +![](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/img/Two-relay-shields-one-arduino.png) + +- Relay Shield #1 GND pins are connected to Relay Shield #2 GND pins +- Relay Shield #1 5V pin is connected to Relay Shield #2 5V pin +- Relay Shield #1 Digital Pins 8, 9, 10, and 11, are connected to Relay Shield #2 Digital Pins 7, 6, 5, and 4 respectively. + +3.Now you can control relays 1, 2, 3, and 4 in Relay Shield #2 using the Arduino’s 8, 9, 10, and 11 digital I/O pins. See sample code below for controlling RELAY1 in Relay Shield #2: + +``` +int relay1inShield2 = 8; // Digital Arduino Pin 8 is used to control relay 1 in Relay Shield #2 + +// the setup routine runs once when you press reset: +void setup() { + // declare pin 8 to be an output: + pinMode(relay1inShield2, OUTPUT); +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(relay1inShield2,HIGH); // relay is energized (NO is connected to COM) + delay(1000); // wait 1000 milliseconds (1 second) + digitalWrite(relay1inShield2,LOW); // NO is disconnected from COM + delay(1000); // wait 1000 milliseconds (1 second) +} +``` + +## Related Reading +--- +- [FAQ of Relay Shield ](http://support.seeedstudio.com/knowledgebase/articles/462030-relay-shield-sku-sld01101p) + +## Resource +--- +- [Relay Shield v3.0](https://github.com/SeeedDocument/Relay_Shield_v3.0/raw/master/res/Relay_Shield_v3.0.zip)