mirror of
https://github.com/esp8266/Arduino.git
synced 2026-01-06 05:22:30 +03:00
Committing individual examples instead of one .zip
This commit is contained in:
57
build/shared/dist/examples/motors/stepper_unipolar/stepper_unipolar.pde
vendored
Normal file
57
build/shared/dist/examples/motors/stepper_unipolar/stepper_unipolar.pde
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Stepper Copal Unipolar
|
||||
* ----------------------
|
||||
*
|
||||
* Program to drive a stepper motor coming from a 5'25 disk drive
|
||||
* according to the documentation I found, this stepper: "[...] motor
|
||||
* made by Copal Electronics, with 1.8 degrees per step and 96 ohms
|
||||
* per winding, with center taps brought out to separate leads [...]"
|
||||
* [http://www.cs.uiowa.edu/~jones/step/example.html]
|
||||
*
|
||||
* It is a bipolar stepper motor with 5 wires:
|
||||
*
|
||||
* - red: power connector, I have it at 5V and works fine
|
||||
* - orange and black: coil 1
|
||||
* - brown and yellow: coil 2
|
||||
*
|
||||
* (cleft) 2005 DojoDave for K3
|
||||
* http://www.0j0.org | http://arduino.berlios.de
|
||||
*
|
||||
* @author: David Cuartielles
|
||||
* @date: 20 Oct. 2005
|
||||
*/
|
||||
|
||||
int motorPin1 = 8;
|
||||
int motorPin2 = 9;
|
||||
int motorPin3 = 10;
|
||||
int motorPin4 = 11;
|
||||
int delayTime = 500;
|
||||
|
||||
void setup() {
|
||||
pinMode(motorPin1, OUTPUT);
|
||||
pinMode(motorPin2, OUTPUT);
|
||||
pinMode(motorPin3, OUTPUT);
|
||||
pinMode(motorPin4, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(motorPin1, HIGH);
|
||||
digitalWrite(motorPin2, LOW);
|
||||
digitalWrite(motorPin3, LOW);
|
||||
digitalWrite(motorPin4, LOW);
|
||||
delay(delayTime);
|
||||
digitalWrite(motorPin1, LOW);
|
||||
digitalWrite(motorPin2, HIGH);
|
||||
digitalWrite(motorPin3, LOW);
|
||||
digitalWrite(motorPin4, LOW);
|
||||
delay(delayTime);
|
||||
digitalWrite(motorPin1, LOW);
|
||||
digitalWrite(motorPin2, LOW);
|
||||
digitalWrite(motorPin3, HIGH);
|
||||
digitalWrite(motorPin4, LOW);
|
||||
delay(delayTime);
|
||||
digitalWrite(motorPin1, LOW);
|
||||
digitalWrite(motorPin2, LOW);
|
||||
digitalWrite(motorPin3, LOW);
|
||||
digitalWrite(motorPin4, HIGH);
|
||||
delay(delayTime);
|
||||
}
|
||||
Reference in New Issue
Block a user