Rev 2087 Rev 2089
Line 6... Line 6...
6 #define light1 0x45 // A0 = H (I2C light1) 6 #define light1 0x45 // A0 = H (I2C light1)
7   7  
8 #define LAMP1 13 // Callibration Lamp 1 8 #define LAMP1 13 // Callibration Lamp 1
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 2
12 #define FW3 3 // FilterWheel 1 12 #define FW3 3 // FilterWheel 3
13   13  
14 const int steps = 3500; //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 = 15; // 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
Line 52... Line 52...
52 byte inByte; // RS232 data 52 byte inByte; // RS232 data
53 int dd=0; // data from light 53 int dd=0; // data from light
54 54
55 digitalWrite(LAMP1, HIGH); // All outputs OFF 55 digitalWrite(LAMP1, HIGH); // All outputs OFF
56 digitalWrite(LAMP2, HIGH); 56 digitalWrite(LAMP2, HIGH);
57 digitalWrite(FW1, HIGH); 57 digitalWrite(FW1, LOW);
58 digitalWrite(FW2, HIGH); 58 digitalWrite(FW2, LOW);
59 digitalWrite(FW3, HIGH); 59 digitalWrite(FW3, LOW);
60 delay(300); 60 delay(300);
61 digitalWrite(LAMP1, LOW); // blik 61 digitalWrite(LAMP1, LOW); // blik
62   62  
63 //--------------------------------------------------------- Serial Input 63 //--------------------------------------------------------- Serial Input
64 // if we get a valid byte 64 // if we get a valid byte
Line 127... Line 127...
127 ds.reset(); 127 ds.reset();
128 ds.select(addr); 128 ds.select(addr);
129 ds.write(0x44,1); // start conversion, with parasite power on at the end 129 ds.write(0x44,1); // start conversion, with parasite power on at the end
130 130
131 delay(800); // maybe 750ms is enough, maybe not 131 delay(800); // maybe 750ms is enough, maybe not
132 digitalWrite(FW1, LOW); // blik 132 // digitalWrite(FW1, LOW); // blik
133 133
134 present = ds.reset(); 134 present = ds.reset();
135 ds.select(addr); 135 ds.select(addr);
136 ds.write(0xBE); // Read Scratchpad 136 ds.write(0xBE); // Read Scratchpad
137 137
Line 156... Line 156...
156 Wire.send(0b11000000); // setup (eye light sensing; measurement range 1 [1000 lx]) 156 Wire.send(0b11000000); // setup (eye light sensing; measurement range 1 [1000 lx])
157 Wire.endTransmission(); // stop transmitting 157 Wire.endTransmission(); // stop transmitting
158   158  
159 // Delay for measurement, maybe 100ms is enough, maybe not 159 // Delay for measurement, maybe 100ms is enough, maybe not
160 delay(110); 160 delay(110);
161 digitalWrite(FW2, LOW); // blik 161 // digitalWrite(FW2, LOW); // blik
162   162  
163 // Connect to device and set register light0 163 // Connect to device and set register light0
164 Wire.beginTransmission(light0); 164 Wire.beginTransmission(light0);
165 Wire.send(0x00); // sends light0 165 Wire.send(0x00); // sends light0
166 Wire.endTransmission(); // stop transmitting 166 Wire.endTransmission(); // stop transmitting
Line 203... Line 203...
203 Wire.send(0b11000001); // setup (eye light sensing; measurement range 2 [4000 lx]) 203 Wire.send(0b11000001); // setup (eye light sensing; measurement range 2 [4000 lx])
204 Wire.endTransmission(); // stop transmitting 204 Wire.endTransmission(); // stop transmitting
205   205  
206 // Delay for measurement, maybe 100ms is enough, maybe not 206 // Delay for measurement, maybe 100ms is enough, maybe not
207 delay(110); 207 delay(110);
208 digitalWrite(FW3, LOW); // blik 208 // digitalWrite(FW3, LOW); // blik
209   209  
210 // Connect to device and set register light0 210 // Connect to device and set register light0
211 Wire.beginTransmission(light1); 211 Wire.beginTransmission(light1);
212 Wire.send(0x00); // sends light0 212 Wire.send(0x00); // sends light0
213 Wire.endTransmission(); // stop transmitting 213 Wire.endTransmission(); // stop transmitting