Datasheet

Chapter 6 Light-Sensitive Navigation with Phototransistors
212Robotics with the BOE Shield-Bot
6. The phototransistor supplies the resistor with more or less current.
7. Change the 2 kΩ resistor to a higher value.
8. If the applied voltage is above the threshold voltage, the input register bit for that
pin stores a 1. If it’s below threshold voltage, the input register bit stores a 0.
9. The voltage decreases.
Exercise Solutions
1. V = I × R = 0.001 A × 2000 Ω = 2 V.
2. V = I × R → I = V ÷ R = 4.5 ÷ 2000 = 0.00225 A = 2.25 mA.
3. 105 → 10 with 5 zeros appended and multiplied by 1 pF. 1,000,000 × 1 pF = (1 ×
106) × (1 × 1012) F = 1 × 106 F = 1 μF.
4. It would be
long tDecay = rcTime(7);
5.
ndShade = tRight / (tLeft+tRight) - 0.5 = 1001 ÷ (1001 + 1001) 0.5 =
0.5 0.5 = 0.
6. Solution:
for(int i = 1; i<=50; i++) // Repeat 50 times
{
Serial.print('='); // one = char each time through
}
Project Solutions
1. This is a modified version of HaltUnderBrightLight
/*
* Robotics with the BOE Shield - Chapter 6, Project 1
* Chirp when light is above threshold. Will require updating value of
* threshold & retesting under bright light to get to the right value.
*/
void setup() // Built-in initialization block
{
tone(4, 3000, 1000); // Play tone for 1 second
delay(1000); // Delay to finish tone
}
void loop() // Main loop auto-repeats
{
if(volts(A3) > 3.5) // If A3 voltage greater than 3.5
{
tone(4, 4000, 50); // Start chirping
delay(100);
}
}