Hello everyone... Im hoping i could get some help here for my project. I am doing a motion sensor project with the z8f042a as my MCU and a US-100 ultrasonic sensor.. Ive read the datasheet of the sensor, and the thing is i need to configure that only object within 10cm will be detected...
The codes goes like this:
The Trigger port must be set to HIGH for 10us
If echo is detected the duration of high time in the echo pin must be computed in seconds then converted to distance..
Use an if statement to set r=1 if object is within 10cm range and r=0 if not.
I am using ZSD II for coding and cant do it myself... All the other parts of the codes works... Just this part with the sensor... Please help!
The codes goes like this:
The Trigger port must be set to HIGH for 10us
If echo is detected the duration of high time in the echo pin must be computed in seconds then converted to distance..
Use an if statement to set r=1 if object is within 10cm range and r=0 if not.
I am using ZSD II for coding and cant do it myself... All the other parts of the codes works... Just this part with the sensor... Please help!