Page 334 - Making things move_ DIY mechanisms for inventors, hobbyists, and artists
P. 334
Chapter 10 Projects 311
FIGURE 10-23 Full SADbot circuit-testing setup
#include <Stepper.h> //import stepper library
#define STEPS 200 // 360/1.8 (step angle) = 200 steps/revolution
//declare new stepper objects from stepper library (one per motor)
Stepper right_motor(STEPS, 6, 7); //6=DIR, 7=STEP
Stepper left_motor(STEPS, 11, 12); //11=DIR, 12=STEP
int distance; // how far motors should go
int lowest; // variable to store lowest photocell value
int i; // for looping
// variables for 4 photocell values
int photo_up;
int photo_down;