Team:UC Chile2/Arduino
From 2012.igem.org
(Difference between revisions)
Line 16: | Line 16: | ||
// Pin 3 -> 5 Volts. | // Pin 3 -> 5 Volts. | ||
// Pin 4 -> Pin n° 2 Arduino. | // Pin 4 -> Pin n° 2 Arduino. | ||
- | //Also, a 0.1 uF capacitor would be suitable to wire between ground and 5V. The closest possible to the sensor (it reduces noise). | + | //Also, a 0.1 uF capacitor would be suitable to wire between ground and 5V. The closest possible to the sensor |
+ | //(it reduces noise). | ||
// Instructions down below | // Instructions down below | ||
Line 43: | Line 44: | ||
// Instructions: | // Instructions: | ||
// First, run this program. Data should be sent to Arduino's terminal. Arduino (Tools > Serial Monitor). | // First, run this program. Data should be sent to Arduino's terminal. Arduino (Tools > Serial Monitor). | ||
- | // If it works ok, it should give data every half second (it will show as text in the format i1234f, meaning a 1234 value). | + | // If it works ok, it should give data every half second (it will show as text in the format i1234f, |
- | // Check values given at absolute darkness and absolute lighting conditions. Write them down and add a bit of margin to the number and replace them in LINE B. | + | //meaning a 1234 value). |
+ | // Check values given at absolute darkness and absolute lighting conditions. Write them down and add | ||
+ | //a bit of margin to the number and replace them in LINE B. | ||
// Now, comment LINE A and uncomment LINE B. Run the program again. | // Now, comment LINE A and uncomment LINE B. Run the program again. | ||
// Now it should give values between 0 and 1023. Values are proportional to the intensity of the light source. | // Now it should give values between 0 and 1023. Values are proportional to the intensity of the light source. | ||
Line 50: | Line 53: | ||
Serial.print(pulseCount); // LINE A | Serial.print(pulseCount); // LINE A | ||
- | //Serial.print(map(pulseCount, | + | //Serial.print(map(pulseCount, here_darkeness_value_number , here_light_value_number, 0, 1203)); // LINE B |
Serial.println("f"); | Serial.println("f"); |
Revision as of 00:25, 20 September 2012