0% found this document useful (0 votes)
3 views1 page

Proximity Sensor Motor Control Code

The document describes a Python script that utilizes the APDS sensor and a motor actuator. It continuously reads proximity values from the sensor and controls the motor's rotation speed based on the proximity threshold. If the proximity value exceeds 50, the motor rotates at full speed; otherwise, it stops.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Proximity Sensor Motor Control Code

The document describes a Python script that utilizes the APDS sensor and a motor actuator. It continuously reads proximity values from the sensor and controls the motor's rotation speed based on the proximity threshold. If the proximity value exceeds 50, the motor rotates at full speed; otherwise, it stops.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

from [Link].

apds import APDS


from [Link] import Motor
from time import sleep_ms

ADPS = None
Motor = None
Proximity_Value = None

ADPS = APDS(port=1,ob=True)
Motor = Motor(port=2,ob=True)
ADPS.enable_proximity()
while True:
sleep_ms(100)
Proximity_Value = ADPS.read_proximity()
print('Proximity Value')
if Proximity_Value > 50:
[Link](speed=100, direction=True)
else:
[Link](speed=0, direction=True)
sleep_ms(100)

You might also like