I am trying to calibrate the infrared sensor but I could not succeed.
The sensor is always outputting 0 instead of 1 when no white paper is in front of it.
Playing with the potentiometer does not change anyhting to the output. Note that the problem only occurs for the left and right sensor, the middle sensor is working wel...
Do you have any ideas how to solve this ? Could the sensor somehow be slightly damaged ?
Without an annotated schematic and links to the technical information on the hardware I cannot be sure if I can give an accurate answer. However I will take a SWAG: It sounds like you have one of those sensors that only have a digital output so you are getting what it is designed to output. They have a pot which allows you to adjust the threshold level, not the sensitivity. If you want to measure levels you need a different sensor. This is one of the many circuits.
Yes I tried but it does not change the output value so I guess it is somehow slightly damaged.
Anyway one of the sensors detects something so it is not completely lost.
Meanwhile, I am testing the servo control project of this robot (project 4 servo control of robotcars multipurpose). The aim of the code is to let rotate the servo from 0 to 180 and then from 180 to 0 degrees.
The servo can not achieve this apparently. I adapted the code for the angles and I conclude that the servo can only rotate from 0 to 45 and from 45 to 0 correctly.
Any idea about the reason behind this malfunction ?
Could it be due to the pulsewidth ? From other forums, I could read that sometimes the servo motor should have a higher pulsewidth signal. Is that correct but how should I adapt this ?
It is now working using another similar code with the servo programmed as an object.
I wonder why this method works and not the other but at least it is working. If any one knows the reason behind it, I would be glad to know
Code that works is using servo as object and write the position angle into the object.
Code that does not work completely is working with a function named procedure but does basically the same...
Thanks a lot
With Very Kind Regards
Attached the working (=servo_control_2) and non working code (=servo_control) for the information servo_control.ino (743 Bytes) servo_control_2.ino (584 Bytes)
I have another question regarding servo control; I have concluded that the servo control works well when setting the servo motor to 0 degrees before starting (initializing/reference)
However in the installation, they asked to set up 90 degrees as initializing angle. But if I do so, I have an obvious shift of 90 degrees when playing with the servo control.
So my question is: why do they ask this unlogic initialisation ?