Datasheet

Navigating with Infrared Headlights • Chapter 7
Robotics with the BOE Shield-Bot 231
// Robotics with the BOE Shield - LeftLedOn
// Turn on left LED for brightness testing
void setup() // Built-in initialization block
{
tone(4, 3000, 1000); // Play tone for 1 second
delay(1000); // Delay to finish tone
pinMode(8, OUTPUT); // Left indicator LED
digitalWrite(8, HIGH);
}
void loop() // Main loop auto-repeats
{
}
Testing LED Brightness with Different Resistors
Remember to disconnect power and the programming cable before you make changes to a
circuit. Remember also that the same sketch will run again when you reconnect power, so you
can pick up right where you left off with each test.
Replace the 220 Ω resistor that goes from pin 8 to the right LED’s cathode with a
470 Ω resistor. Note now how brightly the LED glows.
Repeat for a 1 kΩ resistor.
Repeat once more with a 4.7 kΩ resistor.
Replace the 4.7 kΩ resistor with the 220 Ω resistor before moving on to the next
portion of this activity.
Explain in your own words the relationship between LED brightness and series
resistance.
Series Resistance and IR Detection Range
We now know that less series resistance will make an LED glow more brightly. A reasonable
hypothesis would be that brighter IR LEDs can make it possible to detect objects that are
further away.
Re-open and run TestBothIrAndIndicators.
Verify that both LED indicator circuits are working properly before continuing.
Your Turn Testing IR LED Range
With a ruler, measure the furthest distance from the IR LED that a sheet of paper
can be detected when using 2 kΩ resistors, and record your data in the next table.