*Created by Mark Ng
How does it work?
Distance adjustment
**Counterclockwise
decreases distance
**Clockwise increases distance
When this IR detects an obstacle within range it will send an output low.
Move your hand towards the IR LEDs. As you move near them, the IR receiver detects blockage and the obstacle LED will be lighted up.
We are making a basketball score counter. When the loop detects a ball passing through, one count will be added to the score and a melody will be played.
If you want to reset the score, press button A
Connecti
ons
IR sensor Micro: mate
GND Pin 1 Black
VCC Pin 8 Red(5V)
OUT Pin 1 Blue
Digital Speaker
Black Pin 0 Black
Red Pin 0 Red
Green Pin 0 Blue
1. I used scraped acrylic and secured it using 2 screws and nuts and drilled 2 5mm holes.
2. Adjust the distance and test the range. Bend the ir at 90 degrees.
3. Slot the IR into the 2 holes (side view).
4. The back view of the IR sensor.
The M4 screws are used to replace the existing screws used in the micro: mate. As the screws are
longer, we can mount the micro: bit and micro: mate onto the board.
The code
Even though the specifications state that it can operate from 3v to 5v, you will find that the 3v from the micro: bit will not be able to drive this IR sensor.
After programming, remember to connect the micro USB connector to Vin of the micro: mate and switch the selector switch to 5V.
.