@Abhishek An IR sensor should be fine, provided the minimum detection range is respected. You connect the output to an analog pin, and use the analog read function.
I am currently building a wall dodging robot using an Arduino UNO and a HC-SR04 Arduino ultrasonic sensor, I have the programming for the sensor on the front but I am having some trouble writing the program for the back using the analog pins I can send or post the program already written but would like some help writing the program for the back sensor.
@Stefan Miinnaar Unfortunately troubleshooting or creating code is beyond the scope of this article. We suggest that you take a look through the Arduino forum and if you cannot find sample code, to create a new topic.
i simply want to on and off the motor whenever i place hand in front on ir sensor please help me with the program code
@haris We do not provide custom code. You will need to connect the IR sensor to a digital pin, and the motor to a relay. The relay would be connected to a digital pin as well. Read the status of the digital pin connected to the IR sensor and if “high”, set the pin connected to the relay to “high” too.
Hi, I’m using an NPN inductive sensor, and I need to measure a distance from an object, but the sensor is only its 0 and 1024 response, how do I?
@Pedro Masculino Moraes The value needs to be converted via equation or mapping to an actual distance. The user manual should give that information (a value of 0 usually represents the min distance and 1024 the max distance. The readings may or may not be linear.
Hi, Sir I Would Like To Activate Obstacle Avoidance Robot With Push Button so kindly give any program which contain code to activate Obstacles Avoidance Robot With push button
@Josephazim This is one of the simples button-style robots: https://www.robotshop.com/blog/en/how-to-build-a-simple-robot-beetle-robot-4085
SIr , I want to control my bathroom lights using an IR sensor with arduino nano .I want it to sense a certain hand movement (like two times hand wave in front of the sensor ) to switch the lights to ON state and again the same motion to switch them off. How to code sir.
@Arun Since your question is more related to design, please create a new topic on the RobotShop Forum and we would be happy to help.
Hello sir/madam,
Please send me information that how to interface the GP2Y0A02YK0F sensor with arduino for swipe gesture,if you have the code example related to it then do send me.I will be very thankful to you,i’ll be waiting for your reply.
@mustafa The GP2Y0A02YK0F is an analog sensor, so you can use a normal analog pin (and code) for input. What you do with that distance value (within your code) is up to you.
I have a stop watch timer displayed on an LCD screen I’m trying to figure out how to have the clock stay at zero and trigger from an IR sensor on an analog pin. any suggestions would be great my timer currently runs continuously until the reset button is pressed on the UNO
@Patrick Reynolds The question is quite application / code specific, so rather than having a conversation here, it’s best to create a new topic on the RobotShop Forum (such as here or here) with details of the parts you have, and what you’d like to do.
hello, i need to interface an OPB732 sensor with arduino and sent directly the distance readed on another arduino board, can you help me please !!
@meriem If you plan to create your own circuit, you’ll need additional components as detailed on page 4 of the manual. Note that it will not provide you with distance but rather an analog value for time of flight. If you’re new to robotics and it’s a project for yourself, this is not the easiest to start with.
i’m not new i’m a student in electronics engineering (master 1)and i need that for my final project, so it would be very kind of you if you can help me with that i tried this program but i get values between 1023 and 800 and it steel changed it not stable at all even when i totaly cover the sonsor
@meriem Unfortunately we cannot really offer support in the comments section here. Feel free to post your question on either the RobotShop Forum or on letsmakerobots.
if it is possible to get the count value of encoder after completing the loop???
Actually i need to display the encoder value when the sensor is triggered