I'm working on an artistic installation for a college exam and I wanted to activate a continuous servo motor if something is in the proximity (let's say 50 cm) of an ultrasonic sensor and then stop the rotation if nothing is detected.
I think I'm done with the wiring, but I'm in such a mess with the coding, since I've been failing to program it with Maxuino multiple times and I have barely a basic idea on how Arduino language works.
I really hope anyone could help me
Have you managed to read the distance using the sensor and print it ? Please post your best efforts at the coding following the advice given in How to get the best out of this forum
If that prints the distance then you are half way there. Test the distance and of it is greater than the target distance then do what you want with the servo.
I just tested the sketch and in the serial monitor are displayed reversed question marks (horizontally, not upside down like spanish punctuation) every time I put my hand in the proximity of the sensor.
Is that ok? Sorry you are dealing with a real dummy here
You are using a continuous rotation "servo" and they stop when 90, or something close to it, is written to them, but there is something very odd about your code quite apart from that
You seem to calculate the distance and if it is greater than zero (when wouldn't it be ?) you read a single byte from Serial without checking whether there is anything to read or not and make decisions based on the byte read. All very strange
Please describe in words what you are trying to do