Hello everyone. don't judge me i'm a beginner in c programming.
So the project I'm working on is based on an ultrasound sensor attached to machine that calculate the distance between it and the wall behind, and based on the results if the distance is less than 15 cm i need it to cut the machine to not work ( Arduino output 0V) other than that, the machine should be powered on. So i have came up with this code and haven't tested it yet, and i need to know if it's logical and if it can work as it supposed to.
Thanks.
' ' '
< #define echoPin 6 #define trigPin 7 #define autoclavePin 13
long duration;
int distance;
The OP may decide that running the ultrasonic thingy at loop() speed causes too many errors with the ultrasonics needing up to 60ms to fade away. By just running at loop() speed there may be residual ultrasonic waves.