This assignment was fairly easy. All I did was solder on solid core to the existing wires. I attached the yellow wire to the analog input 0 pin, black to ground, and red to 5 volts.
The software is fairly simple--initiate the a0 input pin, and analog read the pin values. I added a delay to slow down the outputs a bit.
Effective Range of operation
The effective range of operation is anywhere above a 3.5in range, where the value will be around ~642 and the value will be ~0 around a 3ft range. Any object farther than 3ft will remain at 0.
If object is closer than this distance
If an object is closer than this distance, the value will decrease starting from ~642. So from the 0in to 3.5in range, the value runs from 0 to ~642.
More analogRead() values
At 20cm, I get 240.
At 40cm, I get 150
At 60cm, I get 85.
At 80cm, I get 70.
Comments