Robo
Junior Member level 3
sharp gp2y0a21yk
I've just bought the distance sensor, but I'm not sure how to use it. I understand that the closer the sensor is to the wall, the higher the output voltage will be. But what do I do with the output voltage so that I can program my robot to avoid hitting walls? (By the way I'm using board of education with BasicStamp 2 module)
I know somehow I need to use an ADC to obtain the digital signal. But how do I let my board of education to "read" the digital signal?
My initial thought is that I connect the output wire to one of the P0 to P15 ports (let say P0), and I program with BasicStamp with the following pseudocode:
if P0 > 2.5V
turn left
else
continue going forward
However, I don't think my BOE will detect what the output voltage is at P0. Anyone has any idea? Thanks.
I've just bought the distance sensor, but I'm not sure how to use it. I understand that the closer the sensor is to the wall, the higher the output voltage will be. But what do I do with the output voltage so that I can program my robot to avoid hitting walls? (By the way I'm using board of education with BasicStamp 2 module)
I know somehow I need to use an ADC to obtain the digital signal. But how do I let my board of education to "read" the digital signal?
My initial thought is that I connect the output wire to one of the P0 to P15 ports (let say P0), and I program with BasicStamp with the following pseudocode:
if P0 > 2.5V
turn left
else
continue going forward
However, I don't think my BOE will detect what the output voltage is at P0. Anyone has any idea? Thanks.