Line 9... |
Line 9... |
9 |
#define LAMP2 6 // Callibration Lamp 2 |
9 |
#define LAMP2 6 // Callibration Lamp 2 |
10 |
#define FW1 7 // FilterWheel 1 |
10 |
#define FW1 7 // FilterWheel 1 |
11 |
#define FW2 8 // FilterWheel 1 |
11 |
#define FW2 8 // FilterWheel 1 |
12 |
#define FW3 3 // FilterWheel 1 |
12 |
#define FW3 3 // FilterWheel 1 |
13 |
|
13 |
|
14 |
const int steps = 200; //3200; // change this to fit the number of steps |
14 |
const int steps = 3500; //3200; // change this to fit the number of steps |
15 |
const int sspeed = 100; // stepper motor speed |
15 |
const int sspeed = 15; // stepper motor speed |
16 |
|
16 |
|
17 |
// initialize the stepper library on pins |
17 |
// initialize the stepper library on pins |
18 |
#define M1 9 |
18 |
#define M1 9 |
19 |
#define M2 10 |
19 |
#define M2 10 |
20 |
#define M3 11 |
20 |
#define M3 11 |
Line 74... |
Line 74... |
74 |
//--------------------------------------------------------- Motor |
74 |
//--------------------------------------------------------- Motor |
75 |
if (sense) |
75 |
if (sense) |
76 |
{ |
76 |
{ |
77 |
// one revolution in one direction |
77 |
// one revolution in one direction |
78 |
Serial.println("clockwise"); |
78 |
Serial.println("clockwise"); |
79 |
myStepper.setSpeed(sspeed/2); |
- |
|
80 |
myStepper.step(30); |
- |
|
81 |
myStepper.setSpeed(sspeed); |
79 |
myStepper.setSpeed(sspeed); |
82 |
myStepper.step(steps-50); |
80 |
myStepper.step(steps); |
83 |
myStepper.setSpeed(sspeed/2); |
- |
|
84 |
myStepper.step(20); |
- |
|
85 |
delay(50); |
81 |
delay(50); |
86 |
digitalWrite(M1, LOW); |
82 |
digitalWrite(M1, LOW); |
87 |
digitalWrite(M2, LOW); |
83 |
digitalWrite(M2, LOW); |
88 |
digitalWrite(M3, LOW); |
84 |
digitalWrite(M3, LOW); |
89 |
digitalWrite(M4, LOW); |
85 |
digitalWrite(M4, LOW); |
Line 155... |
Line 151... |
155 |
//------------------------------------------------------- Light 0 |
151 |
//------------------------------------------------------- Light 0 |
156 |
Serial.print("Light0: COMMAND="); |
152 |
Serial.print("Light0: COMMAND="); |
157 |
// Setup device |
153 |
// Setup device |
158 |
Wire.beginTransmission(light0); |
154 |
Wire.beginTransmission(light0); |
159 |
Wire.send(0x00); // command register |
155 |
Wire.send(0x00); // command register |
160 |
Wire.send(0b11000001); // setup (eye light sensing; measurement range 2 [4000 lx]) |
156 |
Wire.send(0b11000000); // setup (eye light sensing; measurement range 1 [1000 lx]) |
161 |
Wire.endTransmission(); // stop transmitting |
157 |
Wire.endTransmission(); // stop transmitting |
162 |
|
158 |
|
163 |
// Delay for measurement, maybe 100ms is enough, maybe not |
159 |
// Delay for measurement, maybe 100ms is enough, maybe not |
164 |
delay(110); |
160 |
delay(110); |
165 |
digitalWrite(FW2, LOW); // blik |
161 |
digitalWrite(FW2, LOW); // blik |