Professional Documents
Culture Documents
The code has to pause for 1 ms with delay(1) and then store the
IR value by copying whatever digitalRead returns to a variable; for
example, delay(1) followed by irLeft = digitalRead(10)
For both red and infrared LEDs, a smaller resistor will cause the
LED to glow more brightly. A larger resistor results in dimmer
LEDs. In terms of results, brighter IR LEDs make it possible to
detect objects that are farther away. But it can also have
annoying side effects, like seeing the reflection of the surface it is
rolling on and misinterpreting it as an obstacle.